Hi,

Im using Radio Buttons. What I want to do is once a radio button is selected. I want to Redirect/Open another Page. Cant seem to get it to work. This is my line of thought can some one point me in the correct direction?

void Page_Load()
{ 
InSession.Text = Application["NumOfVisitors"].ToString();

if (RadioButtonList1.SelectedIndex = 0)
{
Response.Redirect("Tyree.aspx");
}

}
if(RaidoButtonList1.SelectedItem ="Tyree")
{
 redirect
}

It looks like you have some syntax errors. In your code, you have if (RadioButtonList1.SelectedIndex = 0) -- it should be if (RadioButtonList1.SelectedIndex [B]==[/B] 0) -- notice the double equal sign. The single equal sign, in this case, is used to assigning a value to a variable, whereas a double equal sign is used for comparing values. So, in your code, you've set the RadioButtonList1.SelectedIndex to zero. By using a double equal sign, you can check if RadioButtonList1.SelectedIndex has the value of zero.

void Page_Load()
{ 
  InSession.Text = Application["NumOfVisitors"].ToString();
  //if (RadioButtonList1.SelectedIndex = 0)
  if (RadioButtonList1.SelectedIndex == 0) // Try this instead.
  {
   Response.Redirect("Tyree.aspx");
  }
}
 
// if(RaidoButtonList1.SelectedItem ="Tyree")
if(RaidoButtonList1.SelectedItem =="Tyree")// Same error on this line, but this looks like some incomplete stuff.
{
  redirect
}

Thanks got it. I knew it something simple.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.