前台代码: <asp:DataList ID="dlPT" runat="server" Width="100%" DataKeyField="ID" OnItemCommand="dlPT_ItemCommand" OnItemDataBound="dlPT_ItemDataBound"> <HeaderTemplate> <tr> <td width="20%"> 编号</td> <td width="30%"> 费用</td> <td width="20%"> 操作</td> </tr> </HeaderTemplate> <ItemTemplate> <tr> <td width="20%"> <%#Eval("ID")%> </td> <td width="30%"> <asp:LinkButton ID="lbtnStandard" Text='<%# Eval("Charge").ToString() + "/" + Eval("EveryYear").ToString()%>' CommandName="update" runat="server"></asp:LinkButton> </td> <td width="20%"> <asp:CheckBox ID="ckbCZ" runat="server" AutoPostBack="true" OnCheckedChanged="ckb_Check" /> </td> </tr> </ItemTemplate> </asp:DataList> 后台代码: protected void ckb_Check(object sender, EventArgs e) { string id = ""; for (int i = 0; i < dlPT.Items.Count; i++)// 4 2 { CheckBox ck = (CheckBox)dlPT.Items[i].FindControl("ckbCZ"); if (ck.Enabled && ck.Checked && i.ToString() != hfIndex.Value.Trim()) { id = dlPT.DataKeys[i].ToString(); id = i.ToString(); } } hfIndex.Value = id; for (int i = 0; i < dlPT.Items.Count; i++) { CheckBox ck = (CheckBox)dlPT.Items[i].FindControl("ckbCZ");//4 if (i.ToString() != hfIndex.Value.Trim() && ck.Enabled) { ck.Checked = false; } } }