Postback and asp:table

  • Thread starter Thread starter Maria
  • Start date Start date
M

Maria

Hi

I have a asp:table that I want to hold the values between
postbacks. Hope some one knows how I can get that to work
in an easy way. The table is loaded in runtime with
different textboxes. When i press a button and runs some
server code the page becomes "quite empty"

Thanks in advance

Maria
 
question: are you using "<input type='text'>" or "<asp:textbox id='txt1'
runat='server'>"

if i'm not mistaken, the asp textbox have viewstate enabled by default.
they should re-populate data on postbacks.
 
Hey,

Remember reading about this a while back but if you are adding controls
dynamically to your grid.... postback wont get 'em back. I suggest you read
up some tutorials on http://www.asp.net/Tutorials/quickstart.aspx

and check up on customer server controls.... framework.aspnet.webcontrols
newsgroup might be a good place to start as well...

Regards,
HD
 
meant custom server controls

a few lines from one of the articles at
http://www.dotnetjunkies.com/quickstart/aspplus/doc/webctrlauthoring.aspx

Maintaining State
Every Web Forms control has a ViewState property (inherited from Control)
that enables it to participate in ViewState management. The type of
ViewState is Sytem.Web.UI.StateBag, which is a data structure equivalent to
a hashtable. A control can save data in ViewState as key/value pairs.
ViewState is persisted to a string variable by the ASP.NET page framework
and makes a round trip to the client as a hidden variable. Upon postback,
the page framework parses the input string from the hidden variable and
populates the ViewState property of each control in the control hierarchy of
a page. A control can restore its state (set properties and fields to their
values before postback) using the ViewState property. Control developers
should be aware that there is a performance overhead in sending data by
round trip to the client, and be judicious about what they save in
ViewState.
 
Back
Top