Gridview中实现单选

View Code
 1     <title>无标题页</title>
2 <script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
3 <script type="text/javascript">
4 function show(obj) {
5 $(".test").attr("checked", "");
6 $(obj).attr("checked", "checked");
7 alert(obj.defaultValue) ;
8
9 }
10
11
12 </script>
13 </head>
14 <body>
15 <form id="form1" runat="server">
16 <div>
17 <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False">
18 <Columns>
19 <asp:TemplateField>
20 <ItemTemplate>
21 <input type="checkbox" value="<%# Eval("Orderid") %>" class="test" onclick="show(this)"/>
22 </ItemTemplate>
23 </asp:TemplateField>
24 </Columns>
25 </asp:GridView>
26 </div>
27 </form>
28 </body>
29 </html>

 

你可能感兴趣的:(GridView)