ASP按钮未触发单击事件 [英] asp button not firing single click event

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

问题描述

我在项目中使用了asp:button控件,并且为该按钮编写了onclick事件,因为我只想将一个文本框中的文本复制到另一个文本框中,但是当我第一次单击时,它不会触发,如果我第二次单击它的工作.

我放置了一个断点,当两个文本框中都没有内容时,表示该事件在第一次单击中触发.但是如果源文本框中自动包含任何内容,则在第一次单击中不起作用,而仅在第二次单击中起作用.

即使我将原因设置为validation = false,并且EnableViewState = false也无法正常工作,
我犯了任何错误吗?

请告诉我的紧急情况

期待您的答复.
感谢

I am using asp:button control in my project, and I wrote onclick event for that button, in that just i wants to copy a text from one text box in to another, but when i click first time its not firing, if i click second time its working.

i placed breaking point, when there is no content in the both text box means the the event is firing in the first click. but if there is any content in the source text box automatically its not working in the first click, only works in the second click.

Even though i made cause validation=false, and EnableViewState=false not working properly,
is i made any mistakes

please tell any one for my urgency

Expecting your kind reply.
thanks

推荐答案

我放置了断点,当两个文本框中都没有内容时,表示该事件在第一次单击时触发.但是如果源文本框中有任何内容会自动在第一次单击中不起作用,而仅在第二次单击中起作用.

这使我想到了一种可能性.检查您的文本框是否将AutoPostBack属性设置为true.
如果是,请将其设置为false.

发生的是-如果文本框的AutoPostBack为true,则在其中输入一些文本,然后单击按钮,文本框的文本更改将触发回发,而单击按钮的按钮将不会被调用.而是尝试跳出然后单击按钮,这将是第一次.

让我知道这是否有帮助!
i placed breaking point, when there is no content in the both text box means the the event is firing in the first click. but if there is any content in the source text box automatically its not working in the first click, only works in the second click.

This makes me think of a possibility. Check if your textbox has AutoPostBack property set to true.
If it is, set it to false.

What happens is - if the AutoPostBack for a textbox is true, you enter some text in it and click the button, the textbox''s text change will fire a postback and your button click won''t be called. Instead try tabbing out and then click button, it will be called very first time.

Let me know if this helps!


这篇关于ASP按钮未触发单击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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