Extracting querystring values 
Author Message
 Extracting querystring values

I'm opening an aspx page with a querystring. I want to populate textboxes on
the page with values from the querystring. I'm having trouble extracting the
querystring value(s) (only 1 at present) - ie. text fields not being
populated.

I have tried this code based on help files:

private void Page_Load(object sender, System.EventArgs e)

{

// Get the querystring parameters from the URL

//string strName = Request.QueryString( "name"); (this isn't working)

NameValueCollection coll=Request.QueryString;

string[] strHolder = coll.AllKeys;

string[] strName = coll.GetValues(strHolder[0]);

TextBox1.Text = strName[0];

Quote:
}

Any ideas?

Thanks in advance.



Sat, 23 Oct 2004 19:10:36 GMT  
 Extracting querystring values
Philip,

    You should be using this:

// Get the querystring value.
string strName = Request.QueryString["name"];

    Use brackets, not parenthesis.

    Hope this helps.

--
               - Nicholas Paldino [.NET MVP]


Quote:
> I'm opening an aspx page with a querystring. I want to populate textboxes
on
> the page with values from the querystring. I'm having trouble extracting
the
> querystring value(s) (only 1 at present) - ie. text fields not being
> populated.

> I have tried this code based on help files:

> private void Page_Load(object sender, System.EventArgs e)

> {

> // Get the querystring parameters from the URL

> //string strName = Request.QueryString( "name"); (this isn't working)

> NameValueCollection coll=Request.QueryString;

> string[] strHolder = coll.AllKeys;

> string[] strName = coll.GetValues(strHolder[0]);

> TextBox1.Text = strName[0];

> }

> Any ideas?

> Thanks in advance.



Sat, 23 Oct 2004 20:41:15 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Passing querystring values

2. Hook/Extract/Get the value from a textbox/combobox/listbox/etc

3. Extracting Email Header Values?

4. Extract SqlDataReader row values without looping through columns?

5. How to extract symbol values from COFF?

6. Set/Extract right 24 bits of 32 bit value

7. Extracting Ascii Value from String?

8. Extracting Ascii Value from String?

9. Extracting the values....

10. Extracting The String From A DWORD Value??

11. Extracting Ascii Value from String?

12. How to extract map values into set?

 

 
Powered by phpBB® Forum Software