Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Building Controls / May 2005

Tip: Looking for answers? Try searching our database.

ListControl: SelectedIndexChanged event raised without implementing IPostBackDataHandler?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Henri - 19 May 2005 00:16 GMT
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
MasterGaurav - 20 May 2005 11:08 GMT
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
------------------------

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.