读书人

gridview加RadioButton相关有关问题

发布时间: 2012-08-09 15:59:22 作者: rapoo

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)
{

}

读书人网 >asp.net

热点推荐