可能重复:
链接到单选按钮选择,asp.net c#
我有一个带有 textarea 和单选按钮的页面。文本区域填充了基于单选按钮选择的数据。我希望单选按钮选择出现在 url 中,以便用户可以链接到单选按钮选择。
我希望我需要做的就是修改我的查询字符串以包含单选按钮值。这是我进行单选按钮选择时提琴手捕获的数据。
__EVENTTARGET ctl00$MainContent$RadioButtonList1$6
__EVENTARGUMENT
__LASTFOCUS
__VIEWSTATE /+++PC9wPg0KPHA+/....
__EVENTVALIDATION /wEWCwKY7d6oAQLh8vmTCALk7M7lDQK+6NunDwK/6OenDwK86OenDwK86OunDwK86POnDwK96NenDwK96NunDwKxh73KA3Q+PMuKU/JUCKsF1aiY2DNLu7/pFFni/Qtz+7FXy35g
ctl00$MainContent$RadioButtonList1 41
我希望我的网址只需要看起来像这样指向单选按钮值,但我需要的是适当的语法:
http://www.test.com/test.aspx?ctl00$MainContent$RadioButtonList1$41
---后面的代码---
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack == false)
{
RadioButtonList1.SelectedIndex = 0;
RadioButtonList1.DataBind();
}
else
{
string strRedirect;
strRedirect = "frm_Articles.aspx?Article_PK=" + RadioButtonList1.SelectedValue.ToString();
Response.Redirect(strRedirect);
}
}
protected void SqlDataSource2_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{
//
}
protected void SqlDataSource1_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{
try{
e.Command.Parameters["@URL_FK"].Value = Session["URL_PK"];
}
catch (Exception ex)
{
}
}
}