.NETGURU
Why text box is not clear
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngcs' list.


Vo Thanh Hoa
Hi group

Sorry for my stupic question below

I put one button and one text box into a form of an ASP.NET page. Thay are all web control. I deleberately set EnableViewState of the text box to false. The content of the text has nothing. In the code-behind of the correspoinding class
I set the text property of the text control to something like "Yamaha Toyota OShama Bin Laden" only when the page is not postback. Here is the code

private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
TextBox1.Text = " Yamaha Toyota OShama Bin Laden";
}
}
But when I run this page and hit the button. The content of the text box is not change. I think because I have set its EnableViewState to false so when the page is postback. It should be clear. I have test other control like list box. But its ( the list box) content is clear. Any one have idea ? It seem not consistency, is it ?

Best regard.
Reply to this message...
 
    
Andy Smith
your textbox is not emptied after postback, because the textbox gets =
everything it needs to know from just the post. It recieves it's text =
value from the post. however, it won't be able to know if it has been =
changed from before without viewstate.

your listbox was empty after postback because the only thing it gets =
back from the postback is the selected value. it does not get the list =
of items it contains. If you were to staticly populate the listbox right =
on the page or in an Init handler, then the listbox would be able to =
show it's selected value after postback.

__
Andy Smith
Keyboard Jockey #3a7-2.78.1

[Original message clipped]

Reply to this message...
 
    
Hue Phung
Hi group

Sorry for my stupic question below

I put one button and one text box into a form of an ASP.NET page. Thay are all web control. I deleberately set EnableViewState of the text box to false. The content of the text has nothing. In the code-behind of the correspoinding class
I set the text property of the text control to something like "Yamaha Toyota OShama Bin Laden" only when the page is not postback. Here is the code

private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
TextBox1.Text = " Yamaha Toyota OShama Bin Laden";
}
}
But when I run this page and hit the button. The content of the text box is not change. I think because I have set its EnableViewState to false so when the page is postback. It should be clear. I have test other control like list box. But its ( the list box) content is clear. Any one have idea ? It seem not consistency, is it ?

Best regard.
Reply to this message...
 
    
Vo Thanh Hoa
Hi group
=20
Sorry for my stupic question below
=20
I put one button and one text box into a form of an ASP.NET page. Thay are all web control. I deleberately set EnableViewState of the text box to false. The content of the text has nothing. In the code-behind of the correspoinding class
I set the text property of the text control to something like "Yamaha Toyota OShama Bin Laden" only when the page is not postback. Here is the code
=20
private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
TextBox1.Text =3D " Yamaha Toyota OShama Bin Laden";=20
}
}
But when I run this page and hit the button. The content of the text box is not change. I think because I have set its EnableViewState to false so when the page is postback. It should be clear. I have test other control like list box. But its ( the list box) content is clear. Any one have idea ? It seem not consistency, is it ?=20
=20
Best regard.
=20
Reply to this message...
 
    
Vo Thanh Hoa
Thank Andy=20
Maybe I undestand now. I have reviewed .NET document.=20
When postbacking, my text box's content is set two times, from =
ViewState data and Postback data.
My textbox's content is not clear because of Postback data.=20

-----Original Message-----
From: Andy Smith [mailto:Click here to reveal e-mail address]
Sent: Thursday, July 11, 2002 10:37 PM
To: aspngcs
Subject: [aspngcs] RE: Why text box is not clear

your textbox is not emptied after postback, because the textbox gets =
everything it needs to know from just the post. It recieves it's text =
value from the post. however, it won't be able to know if it has been =
changed from before without viewstate.

your listbox was empty after postback because the only thing it gets =
back from the postback is the selected value. it does not get the list =
of items it contains. If you were to staticly populate the listbox right =
on the page or in an Init handler, then the listbox would be able to =
show it's selected value after postback.

__
Andy Smith
Keyboard Jockey #3a7-2.78.1

[Original message clipped]

| http://www.asplists.com/asplists/aspngcs.asp =3D JOIN/QUIT
</BODY></HTML>
[Original message clipped]

Reply to this message...
 
 
System.EventArgs




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification