The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

Binding sources, dataGrid Views, and textboxes

Last post 08-26-2008, 9:45 AM by dfblaze. 3 replies.
Sort Posts: Previous Next
  •  08-19-2008, 4:03 PM 10831

    Binding sources, dataGrid Views, and textboxes

    well, hi again... I come with a new problem :) You see, I managed to work with Entityspaces.
     
    I did all the basic stuff for the northwind database, add, remove, modify and search; ive been using binding sources throughout the whole process. However, now my task is to use the same binding source to get data to the data grid view, and that same data has to go to my textboxes through my binding source.
     
    While im posting this, i have another question. At least, its necessary for me to do this.
     
    I know that to search only for one record (By ID, for example), i have to use a "products" object, instead of a productsCollection object. Right? Is it possible to do it using a collection? actually i just came up with trying to do it with a query and a where... :P
     
    So, um, back to my main idea.
     
    If the original data source is the products object, or the productscollection object, and it goes to the binding source, and from the binding source it goes to the data grid view, how in heaven can i call that information from the binding source to the textboxes?? Since I'm using EntitySpaces, I don't want to be forced to add a connection to a data source, because that would be plainly stupid. Wouldnt it?
     
    Ive been having a headache with this for a while.... :(
     
    thanks a lot in advance for your answer , and for your time. :)
  •  08-19-2008, 5:57 PM 10832 in reply to 10831

    Re: Binding sources, dataGrid Views, and textboxes

    Let me see if I can help some.

    On the collection classes there is a FindByPrimaryKey method. There is also a Filter property which you can use to filter based on any of the columns. Also, if you're using .NET 3.5 you can use full LINQ queries into our collections.

    As for the binding, do you mean when they select a row in the Grid you want that row (say Products entity) to bind to some text boxes for editing?


    EntitySpaces | Twitter | BLOG | Please honor our Software License
  •  08-26-2008, 5:16 AM 10913 in reply to 10831

    Re: Binding sources, dataGrid Views, and textboxes

    Hi

    Assuming you have a bindingsource already set up on your form (called bindingsource1), adding databinding to the textboxes is the same as you would normally do without EntitySpaces - e.g. I have a DGV set up on my form - the grid is bound to a bindingsource (bindingsource1), the bindingsource is bound to my collection "coll", I've loaded my collection (coll.LoadAll()), to add a binding to a text box (called "textbox1") to show the first name of the current selected entity, I've added the following binding:

    Code:
    me.textBox1.DataBindings.Add("Text", me.bindingSource1, "FirstName")

    All works as expected

    thanks

    Martin

     

     

  •  08-26-2008, 9:45 AM 10926 in reply to 10913

    Re: Binding sources, dataGrid Views, and textboxes

    Thanks a lot Martin, it all does indeed work as expected!
View as RSS news feed in XML