RadioButtonList在Datagrid模板列中的应用

1.RadioButtonList插入DataGrid模板列的方法与其他控件插入的方法一致。

2.从数据库中读取RadioButtonList状态的方法
    1) .aspx文件
         <asp:RadioButtonList .... SelectedIndex='<%# Container.DataItem(”strRBL”) %>'>

     2) .vb文件
         objDataSet.Tables(0).Columns.Add(“strRBL“)
         objDataSet.Tables(0).Rows(x).Item(“strRBL“)=n

3.RadioButtonList状态改变后读取的方法
   1).aspx文件
       <asp:RadioButtonList.... AutoPostBack=“True“  OnSelectedIndexChanged=“RBL_SelectedIndexChanged“

   2).vb文件
       Public Sub RBL_WA_SelectedIndexChanged(ByVal Sender As Object, ByVal e As System.EventArgs)
             Dim srcRBL As RadioButtonList = CType(Sender, RadioButtonList)
             Dim srcCell As TableCell = CType(srcRBL.Parent, TableCell)
             Dim srcRow As TableRow = CType(srcCell.Parent, TableRow)
       End Sub

       srcRBL即为状态改变的RadioButtonList,可用SelectedIndex/SelectedValue获取相应值
       srcRow即位状态改变的RadioButtonList所在的DataGrid行,可用srcRow.Cells(n).Text获取相应的主键值将RadioButtonList状态写入数据库

<%# Container.DataItem("strType") %>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值