我可以阻止按钮在点击时回发吗? [英] can i prevent a button from posting back when clicked?

查看:80
本文介绍了我可以阻止按钮在点击时回发吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用

AddHandler动态创建按钮并将它们与事件相关联。


我希望所有按钮事件一次触发,当时页面已发布,

而不是单击每个按钮时。

如何在单击按钮时停止回发按钮?


谢谢

I dynamically create buttons and associate them with an event using
AddHandler.

I want all the button events to fire at one time, when the page is posted,
instead of when each button is clicked.

How I stop the buttons from posting back when they are clicked?

Thanks

推荐答案

你为什么要这样做?


bill写道:
why would you want to do that?

bill wrote:

我动态创建按钮并使用

AddHandler将它们与事件相关联。


我希望所有按钮事件一次发布,当页面被发布时,

而不是点击每个按钮时。


我如何停止单击按钮时回发的按钮?


谢谢
I dynamically create buttons and associate them with an event using
AddHandler.

I want all the button events to fire at one time, when the page is posted,
instead of when each button is clicked.

How I stop the buttons from posting back when they are clicked?

Thanks


如果我告诉你原因,你会吗?告诉我怎么样?


我的页面是用数字动态构建的用于数据输入的控件

用途(如问卷),包括单选按钮列表,下拉列表

列表,复选框列表,文本框...每个控件都连接到一个公共事件

处理器在页面发布时处理输入。


另外,我已经为输入构建了一个缩放或滑块控件

包含一个包含100个单元格的表格,每个单元格包含一个按钮,对应的值为
到1到100之间的值。该值是

按钮的命令参数。当单击其中一个按钮时,它会触发一个事件,并保存

选择的值。此事件应该是页面上其他控件使用的公共事件处理程序。


我希望所有控件事件在处理时都被处理一次页面是

发布。


谢谢

比尔

< ne ***** *****@gmail.com在留言中写道

news:11 ********************* @ p79g2000cwp.googlegro ups.com ...
If I tell you why, will you tell me how?

My page is built dynamically with a number of controls for data entry
purposes (like a questionnaire), including radio button lists, dropdown
lists, checkbox lists, textboxes... Each control is wired to a common event
handler which processes the input when the page is posted.

In addition, I have constructed a scale or slider control for input which
consists of a table with 100 cells, each containing a button corresponding
to a value between 1 and 100. The value is the command argument of the
button. When one of the buttons is clicked it fires an event, and the
selected value is saved. This event should be the common event handler used
by the other controls on the page.

I want all the control events to be processed one time when the page is
posted.

Thanks
Bill
<ne**********@gmail.comwrote in message
news:11*********************@p79g2000cwp.googlegro ups.com...

你为什么要这样做?


bill写道:
why would you want to do that?

bill wrote:

>我动态创建按钮并使用
AddHandler将它们与事件相关联。

我希望所有按钮事件一次触发,当页面时发布,
而不是点击每个按钮。

如何在点击按钮时停止回发按钮?

谢谢
>I dynamically create buttons and associate them with an event using
AddHandler.

I want all the button events to fire at one time, when the page is
posted,
instead of when each button is clicked.

How I stop the buttons from posting back when they are clicked?

Thanks



你不应该使用单选按钮,复选框,下拉菜单或其他

控制让你的用户回答问卷?


一个按钮表示现在就做点什么。


用户单击按钮选择答案后,按钮不再单击

- 用户无论如何都看不到他们选择的内容。


按钮并不意味着在数据输入方面具有值。您没有

点击按钮输入数据。


您可以通过选择相应的单选按钮或输入

来输入数据输入控件,或从下拉菜单中选择一些内容。


您可以停止发布回按钮。但是,当页面最终发回服务器时,不会发生任何事情。您必须手动输入

javascript跟踪单击的按钮,在下次回发时将其发送到

服务器,并手动处理。你可以做到这一点,

但是从你所描述的那里听起来像是有数据输入按钮是

不是正确的模型开始。

" bill" < be **** @ datamti.comwrote in message

news:%2 ****************** @ TK2MSFTNGP04.phx.gbl。 ..
Shouldn''t you use radio buttons, or checkboxes, or dropdowns, or some other
controls to let your users answer the questionaire?

A button indicates "do something now".

After the user clicks a button to select an answer, the button isn''t clicked
anymore - the user couldn''t see what they selected anyway.

Buttons are not meant to have values in terms of data entry. You do not
enter data by clicking buttons.

You enter data by selecting the appropriate radio button, or typing
something into an input control, or selecting something from a dropdown.

You can stop buttons from posting back. However, when the page does finally
post back to the server, nothing will happen. You would have to manually in
javascript keep track of which buttons were clicked, send that up to the
server on the next postback, and process this manually. You can do this,
but from what you described it sounds like having buttons for data entry is
not the right model to begin with.

"bill" <be****@datamti.comwrote in message
news:%2******************@TK2MSFTNGP04.phx.gbl...

如果我告诉你原因,你能告诉我怎么做吗?


我的页面是用数字动态构建的用于数据输入的控件

用途(如问卷),包括单选按钮列表,下拉列表

列表,复选框列表,文本框...每个控件都连接到一个公共

事件处理程序在页面发布时处理输入。


另外,我已经为输入构建了一个缩放或滑块控件

包含一个包含100个单元格的表格,每个单元格包含一个按钮,对应的值为
到1到100之间的值。该值是

按钮的命令参数。当单击其中一个按钮时,它会触发一个事件,并保存

选择的值。此事件应该是页面上其他控件使用的公共事件处理程序




我希望所有控件事件都处理一次页面是

发布。


谢谢

比尔


< ne * *********@gmail.com在留言中写道

新闻:11 ********************* @ p79g2000cwp。 googlegro ups.com ...
If I tell you why, will you tell me how?

My page is built dynamically with a number of controls for data entry
purposes (like a questionnaire), including radio button lists, dropdown
lists, checkbox lists, textboxes... Each control is wired to a common
event handler which processes the input when the page is posted.

In addition, I have constructed a scale or slider control for input which
consists of a table with 100 cells, each containing a button corresponding
to a value between 1 and 100. The value is the command argument of the
button. When one of the buttons is clicked it fires an event, and the
selected value is saved. This event should be the common event handler
used by the other controls on the page.

I want all the control events to be processed one time when the page is
posted.

Thanks
Bill
<ne**********@gmail.comwrote in message
news:11*********************@p79g2000cwp.googlegro ups.com...

>你为什么要这样做?

bill写道:
>why would you want to do that?

bill wrote:

>>我动态创建按钮并使用
AddHandler将它们与事件相关联。

我希望所有按钮事件一次触发,当页面被发布时,
而不是点击每个按钮时。

如何在点击按钮时停止回发按钮?

谢谢
>>I dynamically create buttons and associate them with an event using
AddHandler.

I want all the button events to fire at one time, when the page is
posted,
instead of when each button is clicked.

How I stop the buttons from posting back when they are clicked?

Thanks




这篇关于我可以阻止按钮在点击时回发吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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