1. <html>
2. <head runat="server">
3. <title>title>
4.
5. <script type="text/javascript">
6. function toggleSelection(targetID) {
7. var radioButton = document.getElementById(targetID);
8. radioButton.checked = !radioButton.checked;
9. }
10. script>
11.
12. head>
13. <body>
14. <form id="form1" runat="server">
15. <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="true"
16. OnRowDataBound="GridView1_RowDataBound">
17. <Columns>
18. <asp:TemplateField>
19. <ItemTemplate>
20. <input id="rdMoveType" type="radio" runat="server" name="rdMoveType" value="Something" />
21. ItemTemplate>
22. asp:TemplateField>
23. Columns>
24. asp:GridView>
25. form>
26. body>
27. html>
- protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
- {
- if (e.Row.RowType == DataControlRowType.DataRow)
- e.Row.Attributes.Add("onclick", "toggleSelection('" + ((HtmlInputControl)e.Row.FindControl("rdMoveType")).ClientID + "');");
- }
No comments:
Post a Comment