当页面加载如何保持文本框的值 [英] When page load how to maintain the textbox value

查看:94
本文介绍了当页面加载如何保持文本框的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有四个文本框和两个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> with UpdateMode ="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 like

Protected Void Page_Load(object Sender, EventArgs e)
{
  if (IsPostBack)
  {
    TextBox1.Text = Request["TextBox1"].ToString();
  }
}

这篇关于当页面加载如何保持文本框的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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