用户名:
密 码: 记住
您当前的位置:首页 > 网络编程 > Net教程

listview里的button事件添加方法

时间:2015-01-29  来源:互联网  作者:佚名
1.
复制代码 代码如下:
<asp:ListView ID="lvBalance" runat="server" >
<LayoutTemplate>
<div id="listDiv" style="width:100%;overflow-y:auto;">
<table border=0 cellpadding=0 cellspacing=0 style="float:left;table-layout:fixed;" class="datagrid-body easydatagrid">
<asp:PlaceHolder id=itemPlaceholder runat=server/>
</table>
<div id="div999" style='display: none; width: 200px;' class="div2"></div>
</div>
</LayoutTemplate>
<ItemTemplate>
<tr><td>
<asp:LinkButton ID="lb_delete" runat="server" CommandArgument='<%#Eval("ItemCode")%>' OnClientClick="return confirm('确定删除此条信息?');" onclick="lb_delete_Click" Text="删除"></asp:LinkButton>
<</td>/tr>
</ItemTemplate>
</asp:ListView>

2.
复制代码 代码如下:
protected void lb_delete_Click(object sender, EventArgs e)
{
LinkButton lbdelete = (LinkButton)sender;
BLLAccount bll_updateBalance = new BLLAccount();
if (hd_vehiclecode.Value != "" && lbdelete.CommandArgument != "")
{
if (bll_updateBalance.deleteBalance(hd_vehiclecode.Value, lbdelete.CommandArgument) == true)
{
this.ClientScript.RegisterStartupScript(this.GetType(), this.Title, "alert('删除成功!');", true);
Datebind();
}
else
{
this.ClientScript.RegisterStartupScript(this.GetType(), this.Title, "alert('删除失败!');", true);
}
}
}
来顶一下
返回首页
返回首页
推荐资讯
GridView分页代码简单万能实用 GridView分页代码简单万能实用复制代码 代码如下: <asp:GridView ID="GridViewHistory"
使用.NET中的Action及Func泛型委托深入剖析 使用.NET中的Action及Func泛型委托委托,在C#编程中占有极其重要的地位,委托可以将函数封装到
相关文章
栏目更新
栏目热门