radio button

C

Claudia Fong

I have a radio button list in webform1 and a button. This button when
clicks, it will open another webform2 which will get the value of the
radio button selected in my first web form.

The problem is that webform2 is the start page.. so when the program
starts, it will give me an error:

Object reference not set to an instance of an object

in this line --> str = Request.Params["radioButton"].ToString();

If I set a default value in the radio button will it work? And how can I
set a default value in the radio button?

Cheers!

Claudi
 
G

Guest

I have a radio button list in webform1 and a button. This button when
clicks, it will open another webform2 which will get the value of the
radio button selected in my first web form.

The problem is that webform2 is the start page.. so when the program
starts, it will give me an error:

Object reference not set to an instance of an object

in this line --> str = Request.Params["radioButton"].ToString();

If I set a default value in the radio button will it work? And how can I
set a default value in the radio button?

Why do you need two pages here? All this can be done within the one
webform
 
C

Claudia Fong

Because the second webpage will act as a pop-up window for the user to
select the other language.
Default language is in english but user is able to change to other
language


Cheers!

Claudi
 
G

Guest

Because the second webpage will act as a pop-up window for the user to
select the other language.
Default language is in english but user is able to change to other
language

hm, okay
in this line --> str = Request.Params["radioButton"].ToString();

Try to check it

if (Request.Params["radioButton"] != null) {
str = Request.Params["radioButton"].ToString();
} else {
str = "English";
}
 
C

Claudia Fong

if (Request.Params["radioButton"] != null)
{
str = Request.Params["radioButton"].ToString();
}
else
{
str = "en-US";
}

With this, it will work the first time I load the page, but when I
select another language, it will still go to the code in the else
scope... and it should go to this line

str = Request.Params["radioButton"].ToString();

:(

Cheers!

Claudi
 
G

Guest

if (Request.Params["radioButton"] != null)
{
str = Request.Params["radioButton"].ToString();
}
else
{
str = "en-US";
}

With this, it will work the first time I load the page, but when I
select another language, it will still go to the code in the else
scope... and it should go to this line

str = Request.Params["radioButton"].ToString();

:(

Cheers!

Claudi

*** Sent via Developersdexhttp://www.developersdex.com***

Because Request.Params["radioButton"] does not exist I guess.

on webform1 you have to set radioButton to Request.Params and do

Server.Transfer("webform2.aspx");

if it doesn't work, share all your code here
 

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,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top