Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Submit button

  1. #1
    New to the CF scene
    Join Date
    Jun 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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.

  • #2
    Regular Coder
    Join Date
    Apr 2009
    Posts
    244
    Thanks
    1
    Thanked 20 Times in 20 Posts
    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

  • #3
    New to the CF scene
    Join Date
    Jun 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •