Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
465
Row insertion not supported by this data source. Problem with data comes from LINQ2SQL.
posted

Hi,

I have a Grid with DataSource linked to result from LINQ2SQL stmt.
LINQ2SQL returns 4 columns ( from table A ) out of 8 more columns comes from 2 different tables ( table A and B joined together ).
Grid is using only those 4 columns ( from table A ) and rest of them are not visible to view ( comes only from table A ). I have created grid based on table A.

I have a problem because when I am trying to edit any of existing ( retrieved ) data from LINQ2SQL stmt used by Grid
I simply can't do this. I can select cell but I can not delete/edit or add any character inside any cell.

I am adding a new row to the grid by:

this.testGrid.DisplayLayout.Bands[0].Override.AllowAddNew = AllowAddNew.TemplateOnTop;


I got an error message 'Row insertion not supported by this data source' and I can't even get focus to any cell on the grid.

What I am doing wrong ? Any suggestions how to allow user to add new row ?

Regards
Piotrek

my example :

    DATABASE:
    ---------

    tablea:
      column_1a
      column_2a
      column_3a
      column_4a
      column_5a
      column_6a
      column_7a
      column_8a

    tableb:
      column_1b
      column_2b
      column_3b
      column_4b
 

    C# CODE:
    --------
   
    ( on_Load Form event ... )

    var query_test = from a in dc_test.tablea
                from b in dc_test.tableb
                where
                     ( a.column_1a == b.column_1b &
                       b.column_2b == '123' )   
                select new
                {
                    a.column_1a,
                    a.column_4a,
                    a.column_5a,
                    a.column_6a,                   
                };


this.testGrid.DisplayLayout.Bands[0].Override.AllowAddNew = AllowAddNew.TemplateOnTop;
this.testGrid.DataSource = query_test;
this.testGrid.DataBind();
this.testGrid.Refresh();