华域联盟 .Net listview里的button事件添加方法

listview里的button事件添加方法

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);

}

}

}
您可能感兴趣的文章:

  • listview Button始终放在底部示例
  • Listview中Button抢占焦点的解决方法

本文由 华域联盟 原创撰写:华域联盟 » listview里的button事件添加方法

转载请保留出处和原文链接:https://www.cnhackhy.com/45729.htm

本文来自网络,不代表华域联盟立场,转载请注明出处。

作者: sterben

发表回复

联系我们

联系我们

2551209778

在线咨询: QQ交谈

邮箱: [email protected]

工作时间:周一至周五,9:00-17:30,节假日休息

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

关注微博
返回顶部