Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    May 2007
    Location
    Pasadena, CA
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Program links into a textbox

    Ok, new at this so let see if I can ask the correct question.

    I have placed a textbox on my website, I wish to have my clients type a promotional code into the textbox (of which I have many), the promotional code then will link them to the correct page in the website. so I guess my question is how do I code this into the html code. I'm use Visual Studio 2005
    Thanks, WineGuy

  • #2
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    And the logic behind your promo code to html page is...?
    You have to have logic first. Then you code it.

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #3
    New to the CF scene
    Join Date
    May 2007
    Location
    Pasadena, CA
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I customize my program for different groups & companies

  • #4
    Regular Coder Freon22's Avatar
    Join Date
    May 2005
    Location
    USA
    Posts
    287
    Thanks
    3
    Thanked 5 Times in 5 Posts
    Ok don't know where you are pulling your promotional codes from? Database, or a hard code?

    If you are hard coding these promotional codes then you may want to use a case select. If you are calling the codes from a database you would loop through it until you hit a match.

    You could put a <asp:HyperLink ID="HyperLink1" runat="server"></asp:HyperLink> on your aspx page a long with a text box and a button. On button click event you would put in your select case.

    and on the code behind page you could put a select case.

    Select Case myPromotional
    Case CoDe123
    HyperLink1.NavigateUrl = "page1.aspx"
    HyperLink1.Text = "Please Click This link"
    Case CoDe234
    HyperLink1.NavigateUrl = "page2.aspx"
    HyperLink1.Text = "Please Click This link"
    Case CoDe345
    HyperLink1.NavigateUrl = "page3.aspx"
    HyperLink1.Text = "Please Click This link"
    End Select

    The problem with going that way is everytime you want to change the Promotional codes or links you would have to hard code the change. If it was me I would setup a database and would call the promotional codes along with the links. I would code an Admin page so I could change my promotional codes and/or links, could add more promotional codes to it and remove some if I needed to.

    Anyway this should help to get you thinking of which way would be the easyest and best for you.

  • #5
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    Quote Originally Posted by WineGuy View Post
    I customize my program for different groups & companies
    Right, so you have a promo code, but how do you want it to link to a specific page? Like, the page corresponds to a code, and that's stored in the database as a table relationship, or ...?

    Freon22 gave you a good start there, except you don't need to loop through to match a record. You just use a where clause.

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •