当前位置: 代码迷 >> ASP.NET >> gridview加RadioButton相关有关问题
  详细解决方案

gridview加RadioButton相关有关问题

热度:6604   发布时间:2013-02-25 00:00:00.0
gridview加RadioButton相关问题
在gridview里面,我加了两个RadioButton实现审核的通过与不通过功能,单选功能已经实现,但我想把选择的结果怎么更新数据库。。。。求代码。。

------解决方案--------------------------------------------------------
GridView1_RowCommand中
int i = Convert.ToInt32(e.CommandArgument);是当前正在编辑的记录的索引,你通过这个找到主键值,然后将对应的数值update到数据库,通过sql
------解决方案--------------------------------------------------------
使用GridView模板列,然后在ItemTemplate里面加

<asp:TemplateField>
<ItemTemplate>
<asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged">
</asp:RadioButtonList>
</ItemTemplate>
</asp:TemplateField>

protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{

}
  相关解决方案