如何处理回发事件 [英] how to handle post back event

查看:59
本文介绍了如何处理回发事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在page_load事件中创建动态链接按钮和标签.标签显示数据库值,链接按钮是从数据库中删除记录.每个标签控制一个删除按钮.当我单击特定记录的删除按钮时,记录已成功删除,但已删除的记录显示在页面上.我希望删除的记录不显示在页面上.

i m create dynamically link button and label at page_load event. label display the database value and link button is to delete record from database.every label control one delete button. when i m click on delete button of specific record the record is deleted successfully but deleted record display on page. i want deleted record not to display on page .

推荐答案

您可以将记录的ID设置为标签的ID!
然后将您的记录放在面板或每个可以有子控件的控件中!
并在删除记录后将其写入您的代码:
you can set the ID of the record to ID of your label!
then put your records in a panel or every control that can have child control!
and just after deleting the record write this to your code:
Panel.Controls.Remove(label.ID);


我认为您是在谈论Gridview -Item Template- Event bubbling.如果是,则只需在该删除操作之后重新绑定Gridview.查看本教程以获取更多详细信息使用GridView控件更新,删除记录 [
I think you''re talking about Gridview - Item Template - Event bubbling. If yes then just Rebind the Gridview after that delete operation. Check this tutorial for more details Updating, Deleting records using GridView control[^]


您需要在删除后调用绑定代码. ..
you need to call binding code after deleting....


这篇关于如何处理回发事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆