当页面加载如何保持文本框的值 [英] When page load how to maintain the textbox value
问题描述
我有四个文本框和两个dropdown.These应该放到在Panel.This页面刷新得到每一位minute.If我将数据输入到文本框,一分钟即文本框的值refreshed.So如何保持文本框值时,页面后刷新或load.It可以jquery.But我不知道的jQuery much.So请帮助我,我现在用Asp.net和jQuery,C#。
办法之一
块引用>
< ASP:的UpdatePanel>
与的UpdateMode =条件
是当你确信更好的选择,你的TXT值不会回传后更改。
点检查
块引用>如果您不是在pageLoad的重置价值
其他的计算策略
块引用>上绑定
的Page_Load
您的文本框,每次像保护无效的Page_Load(对象发件人,EventArgs的发送)
{
如果(的IsPostBack)
{
TextBox1.Text =请求[TextBox1中]的ToString()。
}
}I have four textbox and two dropdown.These should placed into in Panel.This page get refresh every one minute.If i enter data into textbox,After one minute that textbox values refreshed.So how to maintain the textbox values when page refresh or load.It is possible to jquery.But I dont know jquery much.So please help me.I am using Asp.net,Jquery,C#.
解决方案Approach One
<asp:UpdatePanel>
withUpdateMode ="Conditional"
is better option when you are sure that your txt values are not going to change after postback.Point to Check
IF you are not resetting values in PageLoad
Other Approch
Bind your textbox everytime on
Page_Load
likeProtected Void Page_Load(object Sender, EventArgs e) { if (IsPostBack) { TextBox1.Text = Request["TextBox1"].ToString(); } }
这篇关于当页面加载如何保持文本框的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!