0

Hi,

im making a application and am stuck :)

the page has 3 radio buttons, if the user has selected one i want the page to go to page2.aspx

if the user hasnt selected one i want an error message to be displayed (lblErr) and no navigation to happen.

im very confused ive been reading about altering the aspx code, postbacks, responce.redirect and loads of other things - but just cant seem to peice a solution together any help would be appriciated :)

protected void Button1_Click(object sender, EventArgs e)
    {
       
        if (radio1.SelectedValue == "Image Slot 1")
        {
            location = 1;
            Session["location"] = location;
            // go to page2
        }
        else if (radio1.SelectedValue == "Image Slot 2")
        {
            location = 2;
            Session["location"] = location;
            //go to page 2
        }
        else if (radio1.SelectedValue == "Image Slot 3")
        {
            location = 3;
            Session["location"] = location;
            //go to page 2
        }
        else
        {
            // dont go anywhere and display error message            
            lblErr.Visible = true;                       
           
        }

and here is the aspx

<asp:radiobuttonlist id="radio1" runat="server">
        <asp:listitem id="location1" runat="server" value="Image Slot 1" />
        <asp:listitem id="location2" runat="server" value="Image Slot 2" />
        <asp:listitem id="location3" runat="server" value="Image Slot 3" />
      </asp:radiobuttonlist>

any help (or if im asking for too much - any tips on what i have to research to do it!) would be most appreciated :)

Thanks

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by dnanetwork
0

Never mind i sorted it out :)

if anyone needs to know under each if statmente i have put

Response.Redirect("page2.aspx");

Edited by loveforfire33: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.