ListControl: SelectedIndexChanged event raised without implementing IPostBackDataHandler?

H

Henri

Hi,

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
Nothing
If selected <> item.Selected Then
changed = True
End If
item.Selected = selected
Next

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?
Thanks

Henri
 
M

MasterGaurav

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.RaisePostDataChangedEvent()
Implements IPostBackDataHandler.RaisePostDataChangedEvent
' Do whatever you want to.
End Sub




Cheers,
Gaurav Vaish
http://mastergaurav.org
http://mastergaurav.blogspot.com
------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top