also, when a user makes a radio button selection the url will hold an extention in the url to show which selection index number they have selection. (i.e. ?selected=0)
http://test.com/frm_...aspx?selected=0
http://test.com/frm_...aspx?selected=1
http://test.com/frm_...aspx?selected=2
that way they can copy the url and reference it in other websites as a link. or place it in their favorites. the problem is, if you grab the url and open a new browser, the page does not pass the value and databind accordingly. no radio buttons or content appear on the page.
public partial class test : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
int selected;
if (int.TryParse(Request.QueryString["selected"], out selected))
RadioButtonList1.SelectedIndex = selected;
RadioButtonList1.DataBind();
}
}
protected void SqlDataSource1_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{
try{
e.Command.Parameters["@URL_FK"].Value = Session["URL_PK"];
}
catch (Exception ex)
{
}
}
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
string strRedirect;
strRedirect = "test.aspx?selected=" + RadioButtonList1.SelectedIndex;
Response.Redirect(strRedirect);
}
}

New Topic/Question
Reply




MultiQuote






|