Go Back   CodingForums.com > :: Server side development > ASP.NET

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-08-2011, 06:59 AM   PM User | #1
siri06
New to the CF scene

 
Join Date: Jun 2011
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
siri06 is an unknown quantity at this point
Submit button

Hi there ,

I have a situation that ,

two options are provided to the user with two radio buttons he can select one and clicks a submit button based on the selection the submit button should redirect to the page ,

for example if he selects male then submit button redirect to male page , or if he selects female then submit button redirect to female page like...........


this functionality using asp.net.


Thanks,
Shireesha.

Last edited by siri06; 06-08-2011 at 07:04 AM..
siri06 is offline   Reply With Quote
Old 06-08-2011, 03:45 PM   PM User | #2
Mike_O
Regular Coder

 
Join Date: Apr 2009
Posts: 244
Thanks: 1
Thanked 20 Times in 20 Posts
Mike_O is an unknown quantity at this point
Hi Shireesha,

You would have a setup that would look something like this

Your controls:
Code:
.
.
.
<asp:RadioButtonList ID="Radio1" runat=server>
 <asp:ListItem Value="Male">Male</asp:ListItem>
 <asp:ListItem Value="Female">Female</asp:ListItem>
</asp:RadioButtonList>

<asp:Button ID="Submit" runat="server" OnClick="Submit_OnClick" />
.
.
.
Your codebehind (the submit button onclick handler):
Code:
.
.
.
protected void Submit_OnClick(object sender, EventArgs e)
{
    if (Radio1.SelectedValue = "Male")
    {
        Response.Redirect("MalePage.html");
    }
    else
    {
        Response.Redirect("FemalePage.html");
    }
}
.
.
.
Regards,
Mike
Mike_O is offline   Reply With Quote
Old 06-09-2011, 12:09 AM   PM User | #3
siri06
New to the CF scene

 
Join Date: Jun 2011
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
siri06 is an unknown quantity at this point
Quote:
Originally Posted by Mike_O View Post
Hi Shireesha,

You would have a setup that would look something like this

Your controls:
Code:
.
.
.
<asp:RadioButtonList ID="Radio1" runat=server>
 <asp:ListItem Value="Male">Male</asp:ListItem>
 <asp:ListItem Value="Female">Female</asp:ListItem>
</asp:RadioButtonList>

<asp:Button ID="Submit" runat="server" OnClick="Submit_OnClick" />
.
.
.
Your codebehind (the submit button onclick handler):
Code:
.
.
.
protected void Submit_OnClick(object sender, EventArgs e)
{
    if (Radio1.SelectedValue = "Male")
    {
        Response.Redirect("MalePage.html");
    }
    else
    {
        Response.Redirect("FemalePage.html");
    }
}
.
.
.
Regards,
Mike






Dear Mike thanks for yuoe reply
works perfect



Siri06
siri06 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 02:46 AM.


Advertisement
Log in to turn off these ads.