RadioButtonList madness!

  • Thread starter Thread starter V. Jenks
  • Start date Start date
V

V. Jenks

I have a RadioButtonList and an ImageButton in my form.

In the ImageButton Click event handler I'm trying to
redirect to a new page, passing the value from the
RadioButtonList in a querystring.

Why do I get a null reference when trying to get the
value of the RadioButtonList?

some code:

protected void AddToCartBttn_Click(object
sender, System.Web.UI.ImageClickEventArgs e)
{
if (Page.IsValid)
{
Response.Redirect(
String.Format(
"/
{0}/store/cart.aspx?pid={1}&poid={2}",

this.WebRoot,

this.ProductID,

ProductOptionsList.SelectedItem.Value //the
radiobuttonlist!
),
true
);
}
}


Thanks!

-v
 
Hi V. Jenks,





Probably you can achieve this by using Server.Transfer method. You can find
a small example here at this url
http://www.developer.com/net/asp/article.php/3299641



Alternatively if you want to achieve this by passing the values of the
selected item using the query string try using Server.UrlEncode as shown
below



Value1 and value2 are values for parameter 1 and parameter2.



Response.Redirect( Server.UrlEncode("pagetonavigateto.aspx?param1="+ value1
+"&param2="+value2));







HTH

Regards

Ashish M Bhonkiya
 
Back
Top