Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Problems with Nesting custom controls

Reply
Thread Tools

Problems with Nesting custom controls

 
 
Nauman
Guest
Posts: n/a
 
      05-08-2006
Hi All,

I've created two custom composite controls.
The first one is just a composition of a dropdown and a button. The user is
supposed to select a list item and click the button so that I can get the
value to perform server-side processing. This works just fine.

Where as the second one is a much larger control with many other controls
including the first one. I've instantiated the first control in the Second
one's CreateChildControls method. When I select a value in the embedded
(first control) control's dropdown list and click its associated button,
everything seems to work fine except that, I loose the selected index of the
nested(first control's) control's listbox.

PS: One more thing worth mentioning is that the list values for my first
control are populated in the OnLoad event of the control itself.

protected override void OnLoad(EventArgs e)
{
EnsureChildControls();
if(!Page.IsPostBack)
{
GetJobStates();
if(StateList != null)
{
ddlState.Items.Clear();
for(int iCtr = 0; iCtr < StateList.Length; iCtr++)
{
ddlState.Items.Add(StateList[iCtr]);
}
}
}
base.OnLoad (e);
}

If I remove the "if(!Page.IsPostBack)" check then the second control works
fine with the embedded first control, but the first control doesn't works
independently (without nesting/embedding)

Any Ideas???

Regards
Nauman


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
databound custom controls vs composite databound custom controls rodchar ASP .Net 0 11-26-2007 03:51 PM
Can the nesting of Repeater Controls cause problems? John Kotuby ASP .Net 2 06-04-2007 09:07 PM
Module.nesting -> Kernel#nesting Trans Ruby 10 09-16-2005 12:21 AM
nesting controls Phil Townsend ASP .Net 0 03-08-2005 03:52 PM
'Nesting' Controls and setting their public properties - C# Gramps ASP .Net 1 09-28-2004 02:30 AM



Advertisments