html文件
<table style="790px; line-height:30px" rules="all" cellpadding="0" cellspacing="0" border="1">
<asp:Repeater ID="repGb" runat="server">
<HeaderTemplate><tr style="font-weight:bold; background-color:#5BA7FF"><td>留言者</td><td>
留言内容</td><td>留言时间</td><td>回复内容</td><td>回复者</td><td>IP</td><td>选择</td><td>审核</td><td>
删除</td><td>状态</td></tr></HeaderTemplate>
<ItemTemplate>
<tr>
<td><%# Eval("gb_author")%></td>
<td><%# StringTruncat(Eval("gb_content").ToString(), 16, "...")%></td>
<td> <%# Eval("gb_publictime")%></td>
<td><%# StringTruncat(Eval("gb_reply").ToString(), 12, "...")%></td>
<td><%# Eval("gb_replyer")%></td>
<td><%# Eval("gb_ip")%></td>
<td> <asp:CheckBox ID="cb" runat="server" /></td>
<td>
<asp:LinkButton ID="lbtnCheck" runat="server" onclick="lbtnCheck_Click" Font-Size="Small" CommandArgument='<%# Eval("gb_id") %>' Enabled='<%# GetBol_lbtn(Convert.ToString(Eval("gb_checked"))) %>'>通过</asp:LinkButton>
</td>
<td>
<asp:LinkButton ID="lbtndel" runat="server" OnClientClick="return confirm('删除后不可恢复,确定删除?')" onclick="lbtndel_Click" Font-Size="Small" CommandArgument='<%# Eval("gb_id") %>'>删除</asp:LinkButton>
</td>
<td><%# check(Convert.ToString(Eval("gb_checked"))) %></td>
</tr>
</ItemTemplate>
</asp:Repeater>
<tr style="font-weight:bold"><td></td><td></td><td></td><td></td><td></td><td></td>
<td>
<asp:Button ID="btnSelect" runat="server" Text="全选" BorderStyle="None"
onclick="btnSelect_Click" /></td>
<td>
<asp:Button ID="btncheck" runat="server" Text="通过" BorderStyle="None"
onclick="btncheck_Click" /> </td>
<td>
<asp:Button ID="btndel" runat="server" OnClientClick="return confirm('删除后不可恢复,确定批量删除?')" Text="删除" BorderStyle="None"
onclick="btndel_Click" /></td>
<td></td></tr>
</table>
cs文件
//全选按钮
protected void btnSelect_Click(object sender, EventArgs e)
{
if (this.btnSelect.Text == "取消")
{
for (int i = 0; i <= repGb.Items.Count - 1; i++)
{
CheckBox check = (CheckBox)repGb.Items[i].FindControl("cb");
check.Checked = false;
}
btnSelect.Text = "全选";
}
else
{
for (int i = 0; i <= repGb.Items.Count - 1; i++)
{
CheckBox check = (CheckBox)repGb.Items[i].FindControl("cb");
check.Checked = true;
}
btnSelect.Text = "取消";
}
}
//批量审核
protected void btncheck_Click(object sender, EventArgs e)
{
for (int i = 0; i <= repGb.Items.Count - 1; i++)
{
CheckBox check = (CheckBox)repGb.Items[i].FindControl("cb");
if (check.Checked)
{
LinkButton lbtn = (LinkButton)repGb.Items[i].FindControl("lbtnCheck");
int gb_id = Convert.ToInt32(lbtn.CommandArgument);
goe.updateCheck(gb_id);
lbtn.Enabled = false;
}
}
}
//批量删除
protected void btndel_Click(object sender, EventArgs e)
{
for (int i = 0; i <= repGb.Items.Count - 1; i++)
{
CheckBox check = (CheckBox)repGb.Items[i].FindControl("cb");
if (check.Checked)
{
LinkButton lbtn = (LinkButton)repGb.Items[i].FindControl("lbtndel");
int gb_id = Convert.ToInt32(lbtn.CommandArgument);
goe.delById(gb_id);
}
}
repGb.DataBind();
}
}