Generic List Databinding to windows form

Hi All,

I am trying to bind a generic list to the datagridview in the windows application.

The data's are bnding and I could see the data's.

The generic list is of type "customers" which has customerid, companyname,ContactTitle,Contactname etc. I have only three textbox columns defined in my grid but while binding entire customerdataobjects is getting binded.Ideally only the three columns such as customerid,companyname and contactTitle should have binded. why is this happening

Did I need to specify any other settings other than this.....

could any one guide me through this

regards,
Santha



Answer this question

Generic List Databinding to windows form

  • ClydeCoulter

    Hi,

    How did you do the binding With the Data Source window

    Charles


  • My-Spot

    Hi Charles,

    I binded the grid using datasource property in the code behind.

    like this "dgCustomers.DataSource = customerList;"

    In which dgCustomers is the grid and customerList is the generic list.

    Regards,

    Santha


  • Whoisit

    Try binding through the BindingSource object. Drag a BindingSource from the toolbox to the form, rename it to clientBindingSource. Select the grid, in the properties window select the clientBS as it's DataSource.

    In Form_Load: clientBindingSource.DataSouce = custList;

    Charles


  • Generic List Databinding to windows form