473,396 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Databinding Collections

BB
Hey,

CollectionBase has following methods
OnInsertComplete,OnSetComplete,....

When I bind a collection to a datagrid. Is it the datagrid
thats call the OnInsertComplete? Or is it the List.Add
thats calling the OnInsertComplete?

What I don't understand is when OnSetComplete is called
and who is calling it.

Thanks
BB
Nov 20 '05 #1
1 1233
BB,
As you know CollectionBase implements the IList interface. When you bind
your CollectionBase based object to a DataGrid, the DataGrid will use the
IList interface offered by CollectionBase.

The CollectionBase implementation of IList.Add calls OnInsert, does the add
to CollectionBase.InnerList, then calls OnInsertComplete.

Remember the CollectionBase.List property is simply the IList interface that
the CollectionBase implements. While the CollectionBase.InnerList property
is the contained ArrayList.
When I bind a collection to a datagrid. Is it the datagrid
thats call the OnInsertComplete? Or is it the List.Add
thats calling the OnInsertComplete? So yes. The DataGrid is calling IList.Add, which is the same as List.Add,
which is calling the OnInsert & OnInsertComplete overridables.

http://msdn.microsoft.com/library/de...pleteTopic.asp
What I don't understand is when OnSetComplete is called
and who is calling it. OnSetComplete is called when you use the IList.Item property to set an item
of the CollectionBase. (List.Item).

http://msdn.microsoft.com/library/de...pleteTopic.asp

Remember all the CollectionBase.On* methods are called as part of the IList
implementation of the CollectionBase. OnValidate is called from multiple.
One easy way to see what is going on is to derived from CollectionBase,
override all the On* methods, put debug.Writeline in each override, create
an instance of this test class, assign it to an IList variable, call all the
methods of the IList variable.

Public Class TestCollection
Inherits CollectionBase

Protected Overrides Sub OnClear()
Debug.WriteLine(Nothing, "OnClear")
End Sub

Protected Overrides Sub OnValidate(ByVal value As Object)
Debug.WriteLine(value, "OnValidate")
End Sub

' override all the On* method like above

End Class

Dim list As IList = New TestCollection
list.Clear
list.Add("item 1")
list.Remove("item 1")
list.Item(0) = "Silly Me"
' call all methods & properties of IList

The above will also show you the order the methods are called.

Hope this helps
Jay

"BB" <an*******@discussions.microsoft.com> wrote in message
news:0b****************************@phx.gbl... Hey,

CollectionBase has following methods
OnInsertComplete,OnSetComplete,....

When I bind a collection to a datagrid. Is it the datagrid
thats call the OnInsertComplete? Or is it the List.Add
thats calling the OnInsertComplete?

What I don't understand is when OnSetComplete is called
and who is calling it.

Thanks
BB

Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: aroth | last post by:
I have a basic form with some dropdownlist controls that I would like to populate with items from a database. I keep getting the error "Cannot implicitly convert type...
5
by: Trail Monster | last post by:
Ok, I've been searching the net now for several days and can't find how to do this anywhere. Version: VS 2005 Professional Release, 2.0 Framework Background: I have a complex business object...
2
by: ECathell | last post by:
'------------------------------------------------------------------------------------------------ 'Label Formats...
2
by: Dave A | last post by:
I am stuggling with databinding a drop down list, hooking into the SelectedIndexChanged and attempting to avoid using the viewstate. The drop down list is quite large so I would prefer to avoid...
0
by: Steve | last post by:
I'm trying to implement databinding on a composite control and I'm getting an error with the data when I change the DataSource. The first time I set the DataSource and call DataBind() everything...
1
by: Dan Holmes | last post by:
I have a custom dictionary and i would like to bind it to a control. Since Dictionary doesn't implement IList i would have to write it. Is the only way to do this to keep another collection that...
1
by: Hoffmania | last post by:
Is there a good tutorial of getting databinding working with NHibernate collections such as bags with lazy loading. I can access the collection programaticly, but not directly with databinding.
2
by: bpd | last post by:
I have a user control embedded in a gridview as an EditItemTemplate. When updating, the value is not saved to the database. I have an SQLDataSource attached to the Gridview. Can someone point me...
11
by: =?Utf-8?B?R29rdWw=?= | last post by:
I am struck up with a problem and want anyone here to help me out. I am a beginner in .NET trying to learng DataBinding concepts. I have binded 4 text boxes with a dataset but when I say...
0
by: =?Utf-8?B?cGhpbGptY2c=?= | last post by:
I've seen this question asked 100 times, but with no reasonable answer, other than to extend a control etc. Sorry if I'm going over old ground. I've a DropDownList inside a FormView control,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.