当文本框属性为true时,如何获取文本框值. [英] how can i get text box value when text box property is true.
本文介绍了当文本框属性为true时,如何获取文本框值.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好!
这是kranti kumar.
我正在作为Web开发人员.我的问题是我创建了一个文本框并将只读属性设置为true,但是回发后该值消失了.
页面发回后如何管理文本框的值.
plz任何紧急回信.
谢谢.
hello !
This is kranti kumar.
I am working as web developer. My problem is I created one text box and set read only property as true, but after post back the value disappears.
How can I manage the value of the text box after the page post back.
plz any give reply its urgent.
Thank you.
推荐答案
您可以使用此:
Hi,
You can use this:
if (!IsPostBack)
{
}
您可以在其中编写代码.
You can write the code inside this. It does not affect on postbacks.
< asp:textbox id ="TextBox1" runat ="server" readonly ="true" xmlns:asp =#unknown">
<asp:textbox id="TextBox1" runat="server" readonly="true" xmlns:asp="#unknown">
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
TextBox1.Text = "set Text on Page load Test";
}
}
将文本框的EnableViewState
属性设置为true
默认情况下,此选项为true,请检查您是否在任何地方将其设置为false
SetEnableViewState
property of textbox totrue
This one is bydefault true check whether you have made it false anywhere
这篇关于当文本框属性为true时,如何获取文本框值.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文