CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

ASP.NET Web Hosting – 3 Months Free!



Zone: > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: NewsGroup Date Entered: 6/28/2005 2:24:27 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 1 Views: 21 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
2 Items, 1 Pages 1 |< << Go >> >|
subdigital
Asp.Net User
Server controls and ViewState6/28/2005 2:24:27 AM

0/0

I am having a bit of an issue with a complex server control and wanted to post here to hopefully verify my assumptions.

Basically I am losing ViewState for my controls.

I have an array of category controls, each contains a radio button, a name, and a datalist.  Then I have a photo selector tool that allows you to upload an image or select from a list.
Depending on which category has the selected checkbox, the photo gets added to the specific datalist of the category control. 

The datalists do not persist their values across postback, so I have been having to bind them EACH time, while keeping track of their datasources through viewstate.  Shouldn't this sort of thing be done for me?  I am binding the data AFTER the controls are being added to the control tree...

Also, the radio buttons (I am using Metabuilders Global Radio Button) are not holding their checked property at all.    I was under the assumption that any composite server controls I make will not need any extra persistance code since the individual controls already participate in viewstate.  (Yes, I am implementing INamingContainer).

Also, another problem I am having is that this code returns a null ref exception:

if(! Page.IsPostBack)
  //do stuff

, yet I see examples on the web like this all the time in server controls...    Is there something I am missing?

Thanks in advance.



Ben Scheirman
http://www.flux88.com
subdigital
Asp.Net User
Re: Server controls and ViewState6/28/2005 3:28:00 PM

0/0

I figured out the Page.IsPostBack null ref error...    the page is not loaded until the OnLoad method, so moving the databinding check to that method fixed the issue with databinding....  

So, can anyone verify the following:

In order for a composite control to track/keep state of all of it's child controls
  • The control needs to implement INamingContainer
  • The child controls need to be created in CreateChildControls(), added to the control tree, THEN databound.
  • Any custom properties or datasources need manual persistance code
Is this correct?  Am I missing something?


Ben Scheirman
http://www.flux88.com
2 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Professional ASP.NET 3.5 in C and VB: In C# and VB Authors: Bill Evjen, Scott Hanselman, Devin Rader, Pages: 1704, Published: 2008
Professional ASP.NET 2.0 Authors: Bill Evjen, Scott Hanselman, Farhan Muhammad, Srinivasa Sivakumar, Devin Rader, Pages: 1253, Published: 2005
Pro ASP. Net 3. 5 Server Controls and AJAX Components Authors: Rob Cameron, Dale Michalk, Pages: 740, Published: 2008
Professional ASP.NET 2.0 Server Control and Component Development Authors: Shahram Khosravi, Pages: 1186, Published: 2006
Beginning ASP.NET 2.0 in VB 2005: From Novice to Professional Authors: Matthew MacDonald, Pages: 1063, Published: 2006
Pro ASP.NET 2.0 in C# 2005 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1255, Published: 2005
Developing and Implementing Web Applications with Visual C# .NET and Visual Studio .NET: Exam Cram 2, McAd Exam 70-315 Authors: Kirk Hausman, Amit Kalani, Priti Kalani, Ed Tittel, Pages: 555, Published: 2003
Core Internet Application Development with ASP.NET 2.0 Authors: Randy Connolly, Pages: 1049, Published: 2007
Professional ASP.NET 1.1 Authors: Alex Homer, Dave Sussman, Rob Howard, Brian Francis, Karli Watson, Richard Anderson, Pages: 1337, Published: 2004
Developing Web Applications with Visual Basic.NET and ASP.NET Authors: John Alexander, Billy Hollis, Pages: 400, Published: 2002

Web:
The Basics of Creating Server Controls: ASP Alliance This first in a series of articles on server controls covers the basics. ... and Trends for Developing Controls · Post Back - Raising Events · View State ...
CodeProject: Managing ViewState, Rendering and Events in Composite ... Creating child controls, rendering, wiring up events, and managing viewstate when building an advanced custom server control that embeds other server ...
Control.ViewState Property (System.Web.UI) For more information about saving server control view state, see ASP. ... View state is enabled for all server controls by default, but there are ...
The Life and Times of a Server Control What is a Server Control? In ASP.Net, any class which can render an HTML .... ViewState has been restored, and the state of the controls is now as it was on ...
Saving server control properties to ViewState with custom ... Aug 13, 2008 ... And then just add it to any property in the server control that should get persisted in ViewState. If you’re using the property shorthand in ...
ASPNET: Server control: viewstate of child controls and LoadPostData Jan 31, 2008 ... Hi experts, I'm developing a CompositeControl which contains 3 child controls. My problem is: when the page is posted back, ...
Dynamic Web Server Controls and View State When a Web server control is created dynamically at run time, some information about the control is stored in the view state that is rendered with the page.
Server Controls and View State - Stack Overflow Basically if the parent ID is Parent and the child control ID is Child the ID might show up as Parent_Child. This will solve problems with ViewState not ...
ASP.NET Custom Server Control - Extend TextBox Control ViewState ... NET TextBox server control by adding a custom made namevaluecollection class and overrode how ViewState is handled. The custom namevaluecollection class ...
Building simple Custom Web Server Control, ASP.NET GroupBox The CaptionStyle is stored in the ViewState . Later in this article we ..... A very good startup point to get started with custome server controls. cool! ...




Search This Site:










freetext box image ag

how to add a textbox programmatically

asp c# toolbox control

smtpclient and content-transfer-encoding

basic .net matrix question

what tool should i use to start coding?

update not working properly...

how to find back links of a site?

enableviewstate="false" doesn't work

how to get a rigth server path ( virtual ) ;

how to fetch the looped controls

mail.send ???

can not open asp file on internet explorer

8080 port unavailable

connection string

asp.net functions

protect my webpage

ilist return value into collection?

beginers question about javascript and server controls

value types and nullable value types

using session_end to log out a client machine

video tutorial for creating video library

page_load happens before button_click: help

asp templating

session login info

what does this mean...

login page problem

know where i can find windows app tutorials for visual studio?

asp themes/skins

need help, trying to use field names that are sql reserved words

  Privacy | Contact Us
All Times Are GMT