zoukankan
html css js c++ java
GridView中的Radio
1.html
<
html
xmlns
="http://www.w3.org/1999/xhtml"
>
<
head
runat
="server"
>
<
title
>
GridView中的Radio
</
title
>
</
head
>
<
body
>
<
form
id
="form1"
runat
="server"
>
<
div
>
<
asp:GridView
ID
="GridView1"
Width
="100%"
runat
="server"
AutoGenerateColumns
="false"
>
<
Columns
>
<
asp:TemplateField
>
<
HeaderTemplate
>
单选
</
HeaderTemplate
>
<
ItemTemplate
>
<
input
type
="radio"
id
="RadioName"
name
="RadioName"
value
='<%#
Eval("au_id")%
>
'/>
</
ItemTemplate
>
</
asp:TemplateField
>
<%
--<
asp:BoundField DataField
=
"
au_id
"
HeaderText
=
"
au_id
"
/>--
%>
<
asp:BoundField
DataField
="au_lname"
HeaderText
="au_lname"
/>
<
asp:BoundField
DataField
="au_fname"
HeaderText
="au_fname"
/>
<
asp:BoundField
DataField
="phone"
HeaderText
="phone"
/>
<
asp:BoundField
DataField
="address"
HeaderText
="address"
/>
</
Columns
>
</
asp:GridView
>
<
asp:Button
ID
="Button1"
runat
="server"
Text
="显示"
OnClick
="Button1_Click"
/></
div
>
</
form
>
</
body
>
</
html
>
2.cs
using
System;
using
System.Data;
using
System.Configuration;
using
System.Collections;
using
System.Web;
using
System.Web.Security;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Web.UI.WebControls.WebParts;
using
System.Web.UI.HtmlControls;
public
partial
class
GridView_GridView_Radio : System.Web.UI.Page
{
Practice.DAL.authors authorsbll
=
new
Practice.DAL.authors();
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(
!
IsPostBack)
{
DataBindGridView();
}
}
/**/
///
<summary>
///
功 能:绑定GridView
///
作 者:PUKE
///
完成时间:2007-05-18
///
版 权:pukesys@tom.com
///
</summary>
private
void
DataBindGridView()
{
DataSet ds
=
authorsbll.GetList(
""
);
GridView1.DataSource
=
ds;
GridView1.DataBind();
}
/**/
///
<summary>
///
功 能:Button1的Click,获得选中的数据的id值
///
作 者:PUKE
///
完成时间:2007-05-18
///
版 权:pukesys@tom.com
///
</summary>
///
<param name="sender"></param>
///
<param name="e"></param>
protected
void
Button1_Click(
object
sender, EventArgs e)
{
Response.Write(Request.Form.Get(
"
RadioName
"
));
}
}
查看全文
相关阅读:
itchat 监控微信好友撤回消息
JAVA学习笔记(持续更新)
go-gob序列化/反序列化与读写文件性能对比测试
go-单元测试
如何防范常见的Web攻击-转载
go-读写json文件
有关python&&c++的散碎的一些知识点_随时更新
C Primer Plus 嵌入式裸板程序开发
大论文格式总结(word2013)
版本控制系统git和svn
原文地址:https://www.cnblogs.com/puke/p/768664.html
最新文章
一个导航菜单
关于省略号 ...
PHP 如何判断当前用户已在别处登录
PHP_SELF、 SCRIPT_NAME、 REQUEST_URI区别
PHP 函数extension_loaded();
mac升级到10.15 卡塔里娜后office的艰难更新
比尔·盖茨4年捐款280亿美元 挽救600万人生命
写一个实时操作系统内核
Oracle数据表比较记录差异(转)
七牛的存储算法猜测
热门文章
FlatBuffers要点
如何快速的把日志输出到磁盘上
FlatBuffers与protobuf性能比较
定制一个FlatBuffers编译器
在C语言环境下使用google protobuf
docker镜像制作
md5随机性验证
常用SQL语句
windows同时启动多个微信
微信加密聊天工具(持续开发中)
Copyright © 2011-2022 走看看