gridview模版列里添加了一列单选妞,如何取得列里的值根据相对应的该行的索引
gridview模版列里添加了一列单选妞,如何取得列里的值根据相对应的该行的索引.(其实要取得某列里的超链接字符串,当用户选择后,然后按按扭时间跳转到相对应的那页)
最后一段button事件里该怎么写.
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
Literal output = (Literal)e.Row.FindControl( "RadioBtnMarkup ");
output.Text = string.Format(
@ " <input type= " "radio " " name= " "LinkGroup " " " +
@ "id= " "RowSelector{0} " " value= " "{0} " " ", e.Row.RowIndex);
if (LinkSelectedIndex == e.Row.RowIndex)
output.Text += @ " checked= " "checked " " ";
output.Text += " /> ";
}
}
private int LinkSelectedIndex
{
get
{
if (string.IsNullOrEmpty(Request.Form[ "LinkGroup "]))
return -1;
else
return Convert.ToInt32(Request.Form[ "LinkGroup "]);
}
}
protected void SendToLink_Click(object sender, EventArgs e)
{
int LinkID =
Convert.ToInt32(GridView1.DataKeys[LinkSelectedIndex].Value);
....求这部分
}
------解决方案--------------------回发时从EventArgs 的e.RowIndex