radio button

  • Thread starter Thread starter Claudia Fong
  • Start date Start date
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
 
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
 
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
 
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";
}
 
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
 
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
 
Back
Top