473,785 Members | 2,354 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Databinding Collections

BB
Hey,

CollectionBase has following methods
OnInsertComplet e,OnSetComplete ,....

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

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

Thanks
BB
Nov 20 '05 #1
1 1250
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 OnInsertComplet e.

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 OnInsertComplet e? Or is it the List.Add
thats calling the OnInsertComplet e? So yes. The DataGrid is calling IList.Add, which is the same as List.Add,
which is calling the OnInsert & OnInsertComplet e 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(ByVa l 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("it em 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*******@disc ussions.microso ft.com> wrote in message
news:0b******** *************** *****@phx.gbl.. . Hey,

CollectionBase has following methods
OnInsertComplet e,OnSetComplete ,....

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

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
1169
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 'System.Data.SqlClient.SqlDataReader' to 'bugreq.SqlDataReader'". The code from 'codebehind' is posted below. using System; using System.Collections; using System.ComponentModel; using System.Data;
5
3484
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 Employee that contains public properties and several nested objects such as a Spouse object and a List of Coverage objects.
2
1602
by: ECathell | last post by:
'------------------------------------------------------------------------------------------------ 'Label Formats '------------------------------------------------------------------------------------------------ Me.cboLabelFormat1.DataSource = mLabelFormatsCollection Me.cboLabelFormat1.DisplayMember = "FormatName" Me.cboLabelFormat1.DataBindings.Add(New Binding("Text", mProductCollection, "Formatname1")) Me.cboLabelFormat2.DataSource...
2
3038
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 using the view state so I set EnableViewState on the page to false. To enable the drop down list to bind to a datasource I bind it during the OnInit. I do a response.Write during the SelectedIndexChanged event to verify that the event fires. ...
0
3226
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 works fine, but when I set the DataSource to a new value (DataTable) and then call DataBind again, I get some strange results from the command events of some embedded ImageButton controls... althought the data appears to be displayed correctly, the...
1
2468
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 matches the key in the dictionary to an index in the collection? dan Here is the code i want to add IList to. public interface ISystemMessageData
1
2265
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
2545
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 to a good example or discussion about the two way databinding. I use C#. thanks
11
1816
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 adapter.update it gives me 0 records updated! I am not getting any exceptions. Below is the complete code. Someone please help me out. using System; using System.Drawing; using System.Collections; using System.ComponentModel;
0
1325
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, which is hooked up to a GridView. The contents of the DropDownList are being built from an ObjectDataSource using business objects. Problem is, I'm binding the DropDownList's SelectedValue to a property of type int?, and and where adding...
0
9646
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9484
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10157
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10097
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9957
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8983
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7505
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4055
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2887
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.