Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ListBox in composite control. SelectedItem not available.

Reply
Thread Tools

ListBox in composite control. SelectedItem not available.

 
 
shantanu_kush@hotmail.com
Guest
Posts: n/a
 
      07-24-2006
Hi all,

I have a ListBox in a composite control. EnableViewState for the
ListBox is true.

The ListBox is populated with some values.

The user makes a selection in the ListBox and then Clicks a Button.

In the Button Click event, I want to get the SelectedItem of the
ListBox.

The SelectedItem valued is coming to be null.. Also, the ListBox is not
preserving it's ViewState.

Any advice.

Thanks.

Shantanu..

 
Reply With Quote
 
 
 
 
shantanu_kush@hotmail.com
Guest
Posts: n/a
 
      07-25-2006
Hi all,

The problem was that EnsureChildControls() should be called from the
OnInit() override

protected override void OnInit(EventArgs e)
{
EnsureChildControls();
base.OnInit (e);
this.AttachEvents();
}

It works very well now.. Thanks for ur efforts.

Shantanu..

 
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
How to configure Tkinter Listbox to disable state keeping selecteditem highlighted Sarbjit singh Python 1 07-18-2012 11:47 PM
Please Help: ListBox.SelectedItem returns null Ohad Asor ASP .Net 7 07-11-2005 04:18 PM
Please Help: ListBox.SelectedItem returns null Ohad Asor ASP .Net Web Controls 7 07-11-2005 04:18 PM
Selecteditem.value for a listbox in a user control Dave ASP .Net 2 12-07-2004 08:42 PM
ListBox and SelectedItem.Value Mike ASP .Net 4 07-13-2004 09:09 PM



Advertisments