如何停止Button_Click事件上的Page_Load [英] How can stop Page_Load on Button_Click Event

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

问题描述

亲爱的所有人,

在这里,我的问题是当我按下按钮时如何停止page_load事件.

我只想执行按钮单击事件.有可能吗?

好,

当我被设置时

Dear All,

Here my question is how can stop the page_load event when i press button.

i want to execute only Button Click Event. is it possible???

Ok,

When I Was Set

if (!Page.IsPostBack)
{
   LoadCompany();
   LoadDesignation();
   LoadCategories();
   LoadStatus();
}


所有上述方法用于绑定DropDownList.

然后在按钮上单击事件不执行此代码",以便我的所有方法"不被调用,从而使我的DropdownList显示空白值.
然后单击按钮,将无法执行正确选择的dropDownlist值.



请帮我.
谢谢.


All Above Methods For the bind DropDownList.

Then On Button Click Event Not Execute this Code so my All Methods Not Call and so that My DropdownList show blank value.
and on button click not execute proper selected dropDownlist value.



Pleas Help Me.
Thank You.

推荐答案


您不能将其设置为按钮的默认行为,而不是使用服务器端控件,请使用 HTML INPUT 并使用JavaScript
最好的问候
米特沃里(M.Mitwalli)
Hi ,
You can''t it''s Default behavior for button , Instead of using Server side controls use HTML INPUT and use JavaScript
Best Regards
M.Mitwalli


编号
当用户按下按钮时,它将在服务器上启动您的应用程序的实例,并自动执行page_load事件.

而是使用IsPostBack防止页面加载事件更改用户数据-当用户按下按钮时,它将被设置为true.
No.
When your user presses a button, it starts an instance of your application on the server and automatically executes the page_load event.

Instead, use IsPostBack to prevent the page load event changing user data - when the used presses a button it will be set to true.


这取决于您在按钮单击时编写的代码事件,如果您不想回发页面,那么我建议您使用以下
It depend on your code that you written on the button click event, If you do not want to postback the page then I suggest you to use jQuery Ajax from the following LINK. In this technique postback not happen and hence only your button click code will work.
hope this help you


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

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