Loading a page based on the url query string

Posted on 2011-04-21
Last Modified: 2012-05-11
I want to send a mass email merge to all of our customers and have individual links in the email for them to click to complete a brief survey in this format:
When they click that link, I want the page to load with their information.
That page only has one textbox on it. How can I load this particular customer's page simply by entering this URL?

I put this in the script section of the page itself:

The page loads, but just loads the default page, and the textbox is not populated with the customer's number.

So I moved that to the page load section of my code behind, and then I get this error:

Only assignment, call, increment, decrement, and new object expressions can be used as a statement
Line 16:     {
Line 17:         //Panel1.FindControl("txtCustNbr").Focus(); <== this line works when it's not commented out
Line 18:         Page.Request.QueryString["txtCustNbr"];  <== Error here
Line 19:     }

How do I make this work correctly?
Question by:Hers2keep
    LVL 29

    Expert Comment

    by:Paul Jackson
    Use round brackets rather than square :
    LVL 29

    Accepted Solution

    Ignore that didn't see that you were using c#

    It doesn't look like you are assigning the result of the Page.Request.QueryString["txtCustNbr"]; to anything i.e. :

    string custnumber = Page.Request.QueryString["txtCustNbr"];
    LVL 13

    Expert Comment

    by:F Igor
    use in Page load:


    Author Comment

    In PageLoad -
            string custnumber = Page.Request.QueryString["txtCustNbr"];
            txtCustNbr.Text = custnumber;

    Worked like a charm!!!!
    LVL 29

    Expert Comment

    by:Paul Jackson
    you can shorten that to :

            txtCustNbr.Text = Page.Request.QueryString["txtCustNbr"];


    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    I have developed many web applications with asp & and to add and use a dropdownlist was always a very simple task, but with the new, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now