注册 | 登录 | 设为首页 | 加入收藏
您当前的位置:飞翔学院-IT中国 → 编程开发Asp → 文章内容

RadioButtonList在Datagrid模板列中的应用

作者:IT 来源:不详 发布时间:2007-9-1 22:49:40
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状态写入数据库





http://www.itcnw.com/
  • 打印文档
  • 推荐好友
  • 返回顶部
  • 增大字体
  • 减少字体
关于本站 | 工作机会 | 合作网站 | 广告服务 | 市场合作| 联系我们 | 抽奖活动
版权所有: 武汉威俊科技有限公司 Copyright 2005-2007 www.ITCNW.COM All rights reserved