|
Rank: Member Groups: Member
Joined: 8/26/2007 Posts: 12
|
Hi I installed EO controls and populated the Grid control with data from my table (from access) using similar method as showin in demo. but when i try to update the data on web form, the grid takes the data fine but does not update the database. therefore when i reload the page- the data is same old
I did read the documentation all weekend but not able to figure out. I dont see any method associated with the postback button which updates the database. what am I missing?????
apologies for question being too basic for many of you, any help would be appreciated
Thanks
NewUser
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, The Grid never updates the database for you. It provides you several properties indicating what has been updated, but you will need to write the code to update the database. These properties are: http://doc.essentialobjects.com/library/1/eo.web.grid.changeditems.aspxhttp://doc.essentialobjects.com/library/1/eo.web.grid.deleteditems.aspxhttp://doc.essentialobjects.com/library/1/eo.web.grid.addeditems.aspxYou can check these properties in your server side button click handler and then update your database accordingly. Thanks!
|
|
Rank: Member Groups: Member
Joined: 8/26/2007 Posts: 12
|
Hi Thanks for your quick reply I am trying to replace visualstudio supplied gridview control with your grid and stuck on this problem for last 3 days. Given that I am not a programmer can you please take a look at www.sangwanmd.com/medrecand see if any of you could help me Thanks a million in advance
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, You would write For Each EO.Web.GridItem item in eoGrid1.ChangedItems There is a working sample here: http://demo.essentialobjects.com/Default.aspx?path=Grid\_i1\_i6Check the source code of that sample and you will see how to find out all changed items and then write them back to your database. Thanks!
|
|
Rank: Member Groups: Member
Joined: 8/26/2007 Posts: 12
|
I did look at the code and it captures all the changed items beautifully, The problem I have is how to write them to database.
Thanks
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Sanjay wrote:The problem I have is how to write them to database We can only give you some general guidelines on that because everybody's database structure can be different and also because the specific topic is a general ASP.NET coding questions and we can not afford to provide detailed support on such questions. There are several ways to save data to your database. The most basic method is to call a stored procedure or an SQL update statement. If you use SQL Server, you would open a SqlConnection object, then create a SqlCommand object to execute the SP or SQL. You can Google online for this and you should be able to find plenty of information about this. There are other ways, such as through the data source control you have been using. But all of them are built on top of the basic SqlConnection/SqlCommand method. Hope this helps. Thanks!
|
|