How to create datagrid columns from multiple records using LinqtoSql?

Total Post:183

Points:1285
 945  View(s)
Ratings:
Rate this:

I have a sql table and I want each record to be a datagrid column and another sql table with multiple records related to each fieldID.

I would like to display each value in the appropiate column of a datagrid using linq.

  1. Post:378

    Points:2694
    Re: How to create datagrid columns from multiple records using LinqtoSql?

    Hi Ankita, 


    var dc = new YourdataContext();
        yourGrid.DataSource = dc.YourTable.Select( t => new {                                                      t.Property1,                                                     t.RelationTable.Property2,                                                     etc...                    
                                                      } );
       yourGrid.DataBind();

    and add this in the page_load or page_init

      Modified On Apr-04-2018 07:02:35 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!