All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
.NET中加密与解密QueryString的方法_[Asp.Net教程]
PHP的十个高级技巧(下)_[PHP教程]
ASP.NET技巧:DataGrid传统分页方式_[Asp.Net教程]
6种常用ASP.NET验证控件_[Asp.Net教程]
delphi组件的属性使用实例
如何将应用程序由ASP.NET,1.1移植到ASP.NET,2.0_[Asp.Net教程]
20个实用PHP实例代码_[PHP教程]
PHP解析XML,元素结构范例_php资料_编程技术
ASP.NET,2.0的导航控件treeview和menu的实例_.net资料_编程技术
Asp.net的身份验证_[Asp.Net教程]
Reading number is top 10 pictures
Street street fighting
A man's favorite things2
Entered the goddess in the AD1
Li Zongrui hunting video screenshots1
So beauty, will let you spray blood4
Summer is most suitable for young people to travel in China10
泳装名模阿尔贝特妮写真
世界五大海盗
The world's ten biggest attractions of inventory super the moon
Absolutely shocked. National geographic 50 animal photographys1
Download software ranking
好色的外科大夫
Sora aoi - one of more PK
Proficient in JavaScript
Boxer's Top ten classic battle4
Ashlynn Video5
Unix video tutorial10
Macromedia Dreamweaver 8
Tram sex maniac 2 (H) rar bag5
美女写真3
XML+Web+Service开发教程
归海一刀 published in(发表于) 2014/1/30 1:30:46 Edit(编辑)
为DataGrid添加单选框_[Asp.Net教程]

为DataGrid添加单选框_[Asp.Net教程]

为DataGrid添加单选框_[Asp.Net教程]
  使用DataGrid控件添加单选框时,如果直接在模板中加入RadioButton服务器控件,由于.Net的机制,无法将这些RadioButton在客户端出现在同一个组里面。我们可以使用Radio标签来实现。

  HMTL 页面代码
<form id="Form1" method="post" runat="server">
 <asp:datagrid id="DataGrid1" runat="server" AutoGenerateColumns="False">
 <Columns>
  <asp:TemplateColumn>
   <ItemTemplate>
    <input type="radio" name="rdo" <%# GetChecked(DataBinder.Eval(Container, "DataItem")) %> value=’<%# DataBinder.Eval(Container, "DataItem") %>’>
    <asp:Label runat="server" Text=’<%# DataBinder.Eval(Container, "DataItem") %>’ ID="Label1">
    </asp:Label>
   </ItemTemplate>
  </asp:TemplateColumn>
 </Columns>
 </asp:datagrid><br>
<asp:Button id="btnOk" runat="server" Text="确定"></asp:Button>

  下面是Page_Load中的数据绑定代码



Dim arr As New ArrayList
arr.Add("新闻综合")
arr.Add("综艺")
arr.Add("电影")
arr.Add("教育")
arr.Add("戏剧")
arr.Add("军事")
arr.Add("体育")
DataGrid1.DataSource = arr
DataGrid1.DataBind()

  下面是btnOk_Click中获取选择项的代码

Response.Write(Request.Form("rdo"))

  下面是设置绑定项中哪个Radio被中的函数

Public Function GetChecked(ByVal str As String) As String
 If str = Request.Form("rdo") Then
  Return "checked"
 Else
  Return ""
 End If
End Function



添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.