问题文本框事件期间的自动值转换 [英] Problem Automatic value transform during textbox event
问题描述
我有一个表格,其中我使用10个文本框和2个下拉列表,当我在texbox中输入值时,在计算后将其转移到另一个文本框.当我不使用textbox autopostback = true时,它不会转换其他文本框中的值;当textbox AutoPostBack = true时,它引用所有页面和下拉列表中的值0;谁能帮我为什么会出现此问题.
首先,您需要了解Autopostback
属性的重要性.当您将任何控件的autopostback
属性设置为true时,文本框文本中的任何更改或按Tab键都会导致页面刷新,从而导致调用Page_Load
事件.现在,在page_load
事件中,您可能已将dropdownlist的selectedindex
属性设置为0,因此是结果.如果将自动回发设置为falst,则当该文本框的文本发生任何更改时,它将禁用回发到服务器.
为了避免这种影响,您可以考虑使用AJAX进行部分页面渲染.
签出:
1. http://www.xefteri.com/articles/show.cfm?id=18 [< ^ ]
2. http://msdn.microsoft.com/zh-我们/library/system.web.ui.webcontrols.textbox.autopostback.aspx [ http://www.w3schools.com/ajax/default.asp [ http://ajaxexamples.org/ [ ^ ]
3. http://sixrevisions.com/ajax/ajax_techniques/ [ 解决方案
First of all, you need to understand the significance ofAutopostback
property. When you set theautopostback
property of any control to true, then any change in the textbox text or pressing of tab causes the page to refresh, causing calling ofPage_Load
event. Now inpage_load
event you might have set theselectedindex
property of dropdownlist to 0, Hence the result. If you set the Autopostback to falst, it will disable the post back to the server when any change in the text for that text box occurs.
To avoid this effect you can think of Partial Page Rendering using the AJAX.
Check out :
1. http://www.xefteri.com/articles/show.cfm?id=18[^]
2. http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.textbox.autopostback.aspx[^]
AJAX :
1. http://www.w3schools.com/ajax/default.asp[^]
2. http://ajaxexamples.org/[^]
3. http://sixrevisions.com/ajax/ajax_techniques/[^]
Hope this helps.
All the best.
这篇关于问题文本框事件期间的自动值转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!