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