Connecting Tech Pros Worldwide Forums | Help | Site Map

ASP .Net ViewState issue

Newbie
 
Join Date: Feb 2008
Posts: 29
#1: Jun 17 '08
I have a textbox placed in a updatepanel, i have written a textChanged event that gets fired when user types something.
Now i have set the enableViewState property of the TextBox to FALSE
<asp:TextBox ID="txtName" runat="server" AutoPostBack="True"
ontextchanged="txtName_TextChanged" EnableViewState="false" CausesValidation="false"></asp:TextBox>
so what happens is on every postback the textChanged event gets fired.
i would like to block this, while i keep the viewstate property of the textbox to false

any solution?

thanks
Tim

Newbie
 
Join Date: Feb 2008
Posts: 29
#2: Jun 18 '08

re: ASP .Net ViewState issue


When i Said the textChanged event gets fired on every PostBack i ment
It gets fired on any click on any other control on that page.

pls advise
Newbie
 
Join Date: Feb 2008
Posts: 29
#3: Jun 27 '08

re: ASP .Net ViewState issue


hmmmm so i guess this is a knw issue


No answers :-)



thanks anyway :-)
Needs Regular Fix
 
Join Date: Jul 2006
Location: India,Hyderabad
Posts: 367
#4: Jun 27 '08

re: ASP .Net ViewState issue


Hello ,

As you make Autopost back property true, naturally it happens ,

is there any specific use for you ,to make as auto post back.

try making that property as False

Regards
nmsreddi
Frinavale's Avatar
Site Moderator
 
Join Date: Oct 2006
Location: The Great White North
Posts: 5,137
#5: Jun 27 '08

re: ASP .Net ViewState issue


Quote:

Originally Posted by tim007

I have a textbox placed in a updatepanel, i have written a textChanged event that gets fired when user types something.
Now i have set the enableViewState property of the TextBox to FALSE
<asp:TextBox ID="txtName" runat="server" AutoPostBack="True"
ontextchanged="txtName_TextChanged" EnableViewState="false" CausesValidation="false"></asp:TextBox>
so what happens is on every postback the textChanged event gets fired.
i would like to block this, while i keep the viewstate property of the textbox to false

any solution?

thanks
Tim

Your question doesn't make sense to me.
You have a textbox which has it's ViewState disabled.....

This should have no effect on your textChanged event getting fired.
The TextChanged event will only get fired if your textbox's autopostback is set to true.

When you disable the textbox's ViewState, the textbox will not retain it's value when the postback occurs. This means that you have to always set the textbox's Text property so that this information isn't lost...

Could you please rephrase your question and provide more details on what your problem is?

-Frinny
Reply