Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > ListControl: SelectedIndexChanged event raised without implementing IPostBackDataHandler?

Thread Tools

ListControl: SelectedIndexChanged event raised without implementing IPostBackDataHandler?

Posts: n/a

I'm designing a control that inherits ListControl
I was surprised to see that SelectedIndexChanged is part of ListControl. So
why doesn't it implement IPostBackDataHandler?
I added this to my control:

Function LoadPostData(postDataKey As String, postCollection As
NameValueCollection) As Boolean Implements IPostBackDataHandler.LoadPostData

Dim changed As Boolean
For i As Integer = 0 To Items.Count - 1
Dim item As ListItem = Items(i)
Dim selected As Boolean
selected = Not postCollection(UniqueID & "_" & item.Value) Is
If selected <> item.Selected Then
changed = True
End If
item.Selected = selected

Return changed

End Function

but now I can't raise any SelectedIndexChanged from
RaisePostDataChangedEvent() as this event belongs to the base class
ListControl and I get a compile error if I try to.

I really don't understand the logic of ListControl: must I check if values
have changed between posts myself or does ListControl do it by itself? So if
ListControl do it itself, what is a class that inherits ListControl supposed
to do when implementing IPostBackDataHandler?

Can you help me?


Reply With Quote
Posts: n/a
ListControl is abstract class. It's subclasses - CheckBoxList, DDL,
ListBox, RadioButtonList -- all implement IPostBackDataHandler.

btw, make an explicit implementation of the methods. For example:

Private Sub
System.Web.UI.IPostBackDataHandler.RaisePostDataCh angedEvent()
Implements IPostBackDataHandler.RaisePostDataChangedEvent
' Do whatever you want to.
End Sub

Gaurav Vaish

Reply With Quote

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
RadioButtonList.SelectedIndexChanged not raised when the ListItem has Selected="True" Nathan Sokalski ASP .Net 0 10-25-2007 02:31 PM
UserControl Error event is not raised Brad ASP .Net 0 03-08-2005 11:05 PM
ItemDataBound Event - How to access the previous record when this event is raised in DataGrid? NH ASP .Net Datagrid Control 2 12-17-2004 03:58 PM
event from itemtemplate not raised Daniel ASP .Net 3 10-22-2004 01:39 PM
Re: Catch event raised in a user control in parent page Karl ASP .Net 1 08-28-2004 01:01 PM