473,387 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

RadioButtonList madness!

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
Nov 18 '05 #1
1 1502
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
"V. Jenks" <sp**@scientifik.com> wrote in message
news:0d****************************@phx.gbl...
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

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Hazzard | last post by:
I store radiobuttonlist values in the db using the string value of the radio button item value. (nvarchar) I am creating an edit functionality on the asp.net form so that when I reuse my...
5
by: DotNetGruven | last post by:
Anyone have any pointers on how to set the Value and Selected attributes in a ListItem in a RadioButtonList that is in a DataGrid? Here's what I have ------DataGrid------ -- BoundColumn 0 --...
6
by: DotNetGruven | last post by:
I have a webform that has a DataGrid on it with a RadioButtonList in each row. It is a simple On & Off. When the User Clicks on either of the RadioButtons, I need to postback to the server and...
1
by: V. Jenks | last post by:
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....
4
by: Emil | last post by:
Can somebody tell me what would be the syntax for having an if statement and setting the selected index of a radiobuttonlist? This is my first project using ASP.net and I use C#. I have a repeater...
4
by: juststarter | last post by:
Hello, I have an aspx file where i've put a placeholder element. On load (page_load) i create dynamically an html table which contains a checkbox and a radiobuttonlist in each tablerow . The...
5
by: Øyvind Isaksen | last post by:
I'm making a page to update articles. When a radiobuttonlist is displayed, I want the stored value to be displayed as default (checked). Example: I use a procedure to display the...
5
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hallo, I have a radiobuttonlist control that is added on a custom Web User Control. This control has a property that exposes the SelectedIndex property of the embedded radiobuttonlist. When...
6
by: SAL | last post by:
hello, I'm using a radiobuttonlist in an updatepanel in an item template in a Gridview control. I'm populating the radiobuttonlist in the RowDataBound event. I have the control toolkit registered...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.