views:

1303

answers:

1

I have a gridview that is using a LinqDataSource for it's datasource. I've added a FooterTemplate so users can insert new records. The Add Button has a command name that puts the values in a Dictionary list and then calls the LinqDataSource.Insert() method. This works fine. But the gridview never refreshes automatically with the new row. I'm using the LinqDataSource.Selecting event to initially bind the data. I've tried LinqDataSource.Bind() and GridView.Bind() but the gridview is never refreshed. Any idea how to get the GridView to rebind?

Note: I'm not using an UpdateDate panel, simple postback/refresh no ajax

A: 

Once solution that worked was to:

  • Add logic to define DataSourceID for GridView in CodeBehind
  • Call function after Insert() method
Tim Boland
Just setting the DatasourceID in the page load event worked for me. Annoying. Works without any such thing in when using the sqldatasource control.
Christopher Edwards