前台:
<table border="0" cellpadding="0" cellspacing="1" class="meet_tbl">
<tr class="meet_title bold">
<td>会议名称</td>
<td>制定日期</td>
<td>删除</td>
</tr>
<asp:Repeater ID="rptList" runat="server" OnItemCommand="rptList_ItemCommand">
<ItemTemplate>
<tr style='background-color:<%#(Container.ItemIndex%2==0)?"#fff":"#eee"%>' class="meet_tr">
<td><%#Eval("MeetingName") %></td>
<td><%#Eval("SetTime", "{0:yyyy-MM-dd}")%></td>
<td><asp:Button ID="btnDel" runat="server" Text="删除" CommandArgument='<%#Eval("PID") %>' CommandName="del" CausesValidation="false" OnClientClick="return confirm('确定删除?');" /></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
<tr class="meet_title bold">
<td>会议名称</td>
<td>制定日期</td>
<td>删除</td>
</tr>
<asp:Repeater ID="rptList" runat="server" OnItemCommand="rptList_ItemCommand">
<ItemTemplate>
<tr style='background-color:<%#(Container.ItemIndex%2==0)?"#fff":"#eee"%>' class="meet_tr">
<td><%#Eval("MeetingName") %></td>
<td><%#Eval("SetTime", "{0:yyyy-MM-dd}")%></td>
<td><asp:Button ID="btnDel" runat="server" Text="删除" CommandArgument='<%#Eval("PID") %>' CommandName="del" CausesValidation="false" OnClientClick="return confirm('确定删除?');" /></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
后台:
protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
{
switch (e.CommandName)
{
case "del":
string arg = e.CommandArgument.ToString();//参数名
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "<script>alert('不允许删除!')</script>", false);
break;
}
Bind();
}
{
switch (e.CommandName)
{
case "del":
string arg = e.CommandArgument.ToString();//参数名
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "<script>alert('不允许删除!')</script>", false);
break;
}
Bind();
}