Unfortunately, you can't use the IsPostBack check like you would on a normal
control because the controls themselves can be added to the page as a result
of a postback.
The way to check for whether or not you need to initialize your controls is
by hooking up to the control's Load event (or the Page's) and then testing
whether or not the control already has data in it. If that makes sense. So
you would have:
private DropDownList cboStates;
protected override void CreateChildControls()
{
cboStates = new DropDownList();
cboStates.Load += new EventHandler(cboStates_Load);
Controls.Add(cboStates);
}
private void cboStates_Load(object sender, EventArgs args)
{
if (cboStates.Items.Count == 0)
{
// Initialize States Drop Down Here
}
}
"Dave" <microsoft.com> wrote in message
news:com...
I tried using it in the RenderWebPart method and it didn't recognize it.
properties that the user can setup. Once they select their options I want
the part to post back and allow me to save those properties and display the
content based on those properties.