Hello ,I looked through all the the documentation and help and cannot find a sample on how to update my webgrid automatically with sqldatasource.On your sample page it shows: "With ASP.NET 2.0 DataSource Controls such as the SqlDataSourceControl, the WebGrid can provide automatic updating - no code required". but there is no sample anywhere of that.I have seen in the documentation updateDBrow but no sample was found for that.So please let me know how to use webgrid and the sqldatasource to automatically update my grid.ThanksARno
It should "just work" but in my experience I always forget to do the following (and get yelled at when I write it up as a bug).
Set the
grid.DataKeyField = primarykeycolumn
and optionally set
grid.Bands[0].BaseTableName=table
Also, when you create your SqlDataSource be sure to click on Advanced and choose to generate insert update and delete queries. That should be all there is to it.
Now, to get the update to happen you can either postback the entire page, or add an empty UpdateRow event handler (with grid's ajax enabled) and the data will be updated each time the user leaves a row.
Hope this helps,
-Tony
Hello, I have the same problem and I did everythig you said and nothing worked. What could it be? I'm using 2008 Vol1, could that be the problem?
Thanks