Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > radio button

Reply
Thread Tools

radio button

 
 
Claudia Fong
Guest
Posts: n/a
 
      09-12-2007
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

*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      09-12-2007
On Sep 12, 10:36 am, Claudia Fong <(E-Mail Removed)> wrote:
> 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

 
Reply With Quote
 
 
 
 
Claudia Fong
Guest
Posts: n/a
 
      09-12-2007
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

*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
Alexey Smirnov
Guest
Posts: n/a
 
      09-12-2007
On Sep 12, 11:27 am, Claudia Fong <(E-Mail Removed)> wrote:
> 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";
}

 
Reply With Quote
 
Claudia Fong
Guest
Posts: n/a
 
      09-12-2007
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 Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
Claudia Fong
Guest
Posts: n/a
 
      09-12-2007
Is working now.. sorry about that....

Cheers!

Claudi

*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
Alexey Smirnov
Guest
Posts: n/a
 
      09-12-2007
On Sep 12, 12:43 pm, Claudia Fong <(E-Mail Removed)> wrote:
> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Align Radio Button text and button tshad ASP .Net 6 11-26-2009 08:52 AM
Radio button that looks like a button? Martin HTML 8 11-24-2009 12:15 PM
[OT: How to broadcast an internet radio on a real radio world wide?] Jan C. Faerber HTML 0 06-30-2009 08:05 AM
ASP.NET Reset Radio Button in a group of Radio Buttons Scott D Johnson ASP .Net 1 09-27-2006 10:38 PM
Radio button List problem: How to find value of Radio button list's Selected Item using javascript?? Hiten ASP .Net Web Controls 1 05-26-2004 10:32 AM



Advertisments