问题文本框事件期间的自动值转换 [英] Problem Automatic value transform during textbox event

查看:65
本文介绍了问题文本框事件期间的自动值转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表格,其中我使用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 of Autopostback property. When you set the autopostback property of any control to true, then any change in the textbox text or pressing of tab causes the page to refresh, causing calling of Page_Load event. Now in page_load event you might have set the selectedindex 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屋!

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