日期:2014-05-18 浏览次数:20791 次
<asp:DataList ID="achievement" runat="server" Height="200px" Width="512px"> <ItemTemplate> <table style=" border-bottom-style:inherit; border:1px;"> <tr> <td style=" width:5px;"> <asp:CheckBox ID="CheckBox1" runat="server" /> </td> <td style=" width:15px;"> <asp:Label ID="id" runat="server" Text='<%#Eval("ach_id") %>'></asp:Label> </td> <td style=" width:140px;"> <asp:Label ID="pname" runat="server" Text='<%#Eval("project_name") %>'></asp:Label> </td> <td style=" width:65px;"> <asp:Label ID="Label1" runat="server" Text='<%#Eval("deveolpers") %>'></asp:Label> </td> <td style=" width:140px;"> <asp:Label ID="Label2" runat="server" Text='<%#Eval("explanation") %>'></asp:Label>...... </td> <td style=" width:25px;"> <asp:LinkButton ID="Linbutton1" runat="server" Text="编辑" CommandArgument='<%#Eval("ach_id") %>' OnClick="Modifty_Click"></asp:LinkButton> </td> </tr> </table> </ItemTemplate> </asp:DataList> <asp:Button ID="del" runat="server" Text="删除" OnClick="del_Click" /> protected void del_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("请确定是否要删除选中的记录行", "友情提示!", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2, MessageBoxOptions.ServiceNotification); if (result == DialogResult.OK) { for (int i = 0; i < achievement.Items.Count; i++) { System.Web.UI.WebControls.CheckBox checkBox = ((System.Web.UI.WebControls.CheckBox)((DataListItem)achievement.Controls[i]).FindControl("CheckBox1")); if (checkBox.Checked == true) { [color=#FF00FF]string strID = achievement.DataKeys[i].ToString(); string sqlStr = "delete from achievements where ach_id='" + strID + "'"; gwolf_bll.action1(sqlStr);[/color] } } Response.Redirect(Request.Url.ToString()); bind(); } else { DialogResult.Cancel.Equals("true"); } }
foreach (Datalist item in this.datalist.Items) { CheckBox chkItem = (CheckBox)item.FindControl("ChkBox"); if (chkItem.Checked) { //被勾选 ids += chkItem.ToolTip + ","; } } if (ids != "") { ids =