标签:datalist
//前台:
<asp:DataList ID="daliXi" runat="server" Width="100%" RepeatDirection="Horizontal">
<ItemTemplate>
<asp:CheckBox ID="cbXi" runat="server" />
<asp:Label ID="lbXi" runat="server" Text=’ <%#DataBinder.Eval(Container.DataItem,"Stu_xbmc") %>’></asp:Label>
</ItemTemplate>
</asp:DataList>
//后台:
for (int i = 0; i <= daliXi.Items.Count-1; i++)
{.
CheckBox cb=(CheckBox)daliXi.Items[i].FindControl("cbXi");(cb指向”cbXi”的内存地址,修改cb的属性,即修改cbXi)
if (cb.Checked)
{
Label lb = (Label)daliXi.Items[i].FindControl("lbXi");
Response.Write("<script type="text/javascript">alert(‘"+lb.Text+"‘)</:script>");
cb.Checked=false;
}
}
标签:datalist
原文地址:http://9622637.blog.51cto.com/9612637/1614314