RadioButtonList madness!

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
 
A

Ashish M Bhonkiya

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top