Welcome Guest Search | Active Topics | Sign In | Register

Problem Updating Data in Grid Options
Sanjay
Posted: Sunday, March 8, 2009 9:04:32 PM
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
eo_support
Posted: Monday, March 9, 2009 8:46:25 AM
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.aspx
http://doc.essentialobjects.com/library/1/eo.web.grid.deleteditems.aspx
http://doc.essentialobjects.com/library/1/eo.web.grid.addeditems.aspx

You can check these properties in your server side button click handler and then update your database accordingly.

Thanks!
Sanjay
Posted: Monday, March 9, 2009 11:12:29 PM
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/medrec

and see if any of you could help me

Thanks a million in advance

eo_support
Posted: Tuesday, March 10, 2009 8:51:35 AM
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\_i6

Check 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!

Sanjay
Posted: Tuesday, March 10, 2009 8:59:04 AM
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
eo_support
Posted: Tuesday, March 10, 2009 9:52:42 AM
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!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.