Ask a Question related to ASP.NET Building Controls, Design and Development.
-
Henri #1
ListControl: SelectedIndexChanged event raised without implementing IPostBackDataHandler?
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
Henri Guest
-
Custom ListControl OnFocus Event not working
Hey All, I have created a custom control that initially shows a textbox. After the user has typed something in the TextBox a DropDownListbox is... -
DataList's EditCommand event not being raised
I am attempting to raise the EditCommand event of a DataList when a Button in the ItemTemplate is clicked. Here is the HTML used for the... -
ItemDataBound Event - How to access the previous record when this event is raised in DataGrid?
ItemDataBound Event - How to access the previous record when this event is raised in DataGrid? During "ItemDataBound Event", I would like... -
Implementing IPostBackDataHandler in a custom web control with VB.NET
I have created a custom class with Visual Basic that inherits from the drop down list web control. In order to update the value properly, I have... -
SelectedIndexChanged event in DropDownList
Hi. Why cannot I capture the SelectedIndexChanged event from a DropDownList when the viewstate is set to false (it must be set to false because of... -
MasterGaurav #2
Re: ListControl: SelectedIndexChanged event raised without implementing IPostBackDataHandler?
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
Cheers,
Gaurav Vaish
[url]http://mastergaurav.org[/url]
[url]http://mastergaurav.blogspot.com[/url]
------------------------
MasterGaurav Guest



Reply With Quote

