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 / Windows Forms / WinForm Data Binding / October 2004

Tip: Looking for answers? Try searching our database.

Databinding multiple rows?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jesper - 05 Oct 2004 10:10 GMT
A typical scenario in many applications is to be able to be able to select
one or more objects in a list and then be able to edit one or more
properties of those objects at the same time.

Example: You have a list in one side of the dialog, bound to a datatable,
and you have a text box beside it. It is easy to bind the textbox to
propertyA of the item selected in the list. But if the user selects multiple
items, you only want the textbox to display the value if propertyA is the
same value for all selected objects in the list, and otherwise <blank>. If
the user changes anything in the text box, it should be reflected to all the
selected objects.

You can see examples of this in practically any Microsoft product I can
think of. Is this possible using databinding? Or is there no way around a
custom coding.
Knut Vonheim - 05 Oct 2004 19:48 GMT
You can bind several objects to the same UI Controls by
uiControl.DataBinding.Add("Property", _object, "ObjectProperty") a.s uming
all your _objects implement the IEditableObject interface.

Hope this helps!
Regards,
Knut
> A typical scenario in many applications is to be able to be able to select
> one or more objects in a list and then be able to edit one or more
[quoted text clipped - 11 lines]
> think of. Is this possible using databinding? Or is there no way around a
> custom coding.
Jesper - 07 Oct 2004 11:26 GMT
I cant get that to work. Do you mean

uiControl.DataBindings.Add("Property", _object1, "ObjectProperty");
uiControl.DataBindings.Add("Property", _object2, "ObjectProperty");

should work? Because I get an Error:  " This would cause two bindings in the
collection to bind to the same property.". Which leads me to think that I
cant do what I want with databinding.

Also, this is not exactly what I wanted. I want the uiControl to reflect
that the user has selected multiple items in the same list. If I just bind
the uiControl to the uiList.Datasource, I will only get the uiControl to
reflect one (the first) of the selected items, not all of them.

Jesper.

> You can bind several objects to the same UI Controls by
> uiControl.DataBinding.Add("Property", _object, "ObjectProperty") a.s uming
[quoted text clipped - 3 lines]
> Regards,
> Knut
Knut Vonheim - 10 Oct 2004 11:09 GMT
Jesper,

sorry I misled you on my first response to your posting - don't know why,
but I misread it.

Don't know if the following is the leading you in the right direction
either, but in .Net you have

System.Windows.Forms.PropertyGrid and
System.ComponentModel.Design.CollectionEditor.CollectionForm

Perhaps those namespaces, at least, will help you in the right direction?

Regards,
Knut
> I cant get that to work. Do you mean
>
[quoted text clipped - 19 lines]
> > Regards,
> > Knut
Knut Vonheim - 10 Oct 2004 11:11 GMT
Jesper,

sorry I misled you on my first response to your posting - don't know why,
but I misread it.

Don't know if the following is the leading you in the right direction
either, but in .Net you have

System.Windows.Forms.PropertyGrid and
System.ComponentModel.Design.CollectionEditor.CollectionForm

Perhaps those namespaces, at least, will help you in the right direction?

Regards,
Knut
> I cant get that to work. Do you mean
>
[quoted text clipped - 19 lines]
> > Regards,
> > Knut

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.