function GetDeleteItem()
{
var str="";
$("[@name='item'][checked]").each(function()
{
str+=$(this).val()+";";
});
document.getElementById("items").value=str.substring(0,str.length-1);
if(str.length>0)
{
return confirm("确认删除选中项?");
}
else
{
return false;
}
}
<input name="item" type="checkbox" οnclick="" value='<%# Eval("ActivityId")%>'/>
<input id="items" runat="server" type="hidden" />
<input id="Button1" type="button" οnclick="location.href='AddVote.aspx'" value="添加" /> <asp:Button ID="Button3" OnClientClick="GetDeleteItem()" runat="server" Text="删除" οnclick="Button3_Click" />
string words = this.items.Value.ToString();
if (words.Length > 0)
{
VoteBLL myBll = new VoteBLL();
string[] split = words.Split(new Char[] { ';' });
for (int i = 0; i < split.Length; i++)
{
myBll.DeleteVoteActivity(Convert.ToInt32(split[i]));
this.Repeater1.DataSource = myBll.GetVoteList();
this.Repeater1.DataBind();
}
}