日期:2014-05-17 浏览次数:20492 次
<asp:GridView ID="showxzgw1" runat="server" AutoGenerateColumns="False" GridLines="None" > <Columns> <asp:TemplateField > <ItemTemplate> <asp:Label ID="xzidlbl" runat="server" Text='<%# Eval("id") %>' Visible="false"></asp:Label> <ol start="1"> <li> <asp:Label ID="Label1" runat="server" Text='<%# Eval("timu") %>'></asp:Label> <asp:RadioButtonList ID="rbb" runat="server" RepeatDirection="Vertical" RepeatLayout="Table" AutoPostBack="False" onselectedindexchanged="rbb_SelectedIndexChanged"> <asp:ListItem Text="A" Value="A">A</asp:ListItem> <asp:ListItem Text="B" Value="B">B</asp:ListItem> <asp:ListItem Text="C" Value="C">C</asp:ListItem> <asp:ListItem Text="D" Value="D">D</asp:ListItem> </asp:RadioButtonList> <asp:Label ID="aslbl" runat="server" Visible="False"></asp:Label> </li> </ol> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView>
<%@ Page Language="C#" EnableViewState="true" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> protected void Page_Load(object sender, EventArgs e) { DateTime x = DateTime.ParseExact("22/06/2011", "dd/MM/yyyy", null); Response.Write(x.ToString()); System.Data.DataTable dt = new System.Data.DataTable(); if (!Page.IsPostBack) { System.Data.DataRow dr; dt.Columns.Add(new System.Data.DataColumn("Id", typeof(System.Int32))); dt.Columns.Add(new System.Data.DataColumn("timu", typeof(System.String))); for (int i = 0; i < 6; i++) { dr = dt.NewRow(); dr[0] = i; dr[1] = "【孟子E章】" + i.ToString(); dt.Rows.Add(dr); } showxzgw1.DataSource = dt; showxzgw1.DataBind(); } } protected void rbb_SelectedIndexChanged(object sender, EventArgs e) { RadioButtonList x = sender as RadioButtonList; Label aslbl = x.NamingContainer.FindControl("aslbl") as Label; aslbl.Visible = true; aslbl.Text = x.SelectedValue; } </script> <body> <form id="form1" runat="server"> <asp:GridView ID="showxzgw1" runat="server" AutoGenerateColumns="False" GridLines="None"> <Columns> <asp:TemplateField> <ItemTemplate> <asp:Label ID="xzidlbl" runat="server" Text='<%# Eval("id") %>' Visible="false">&l