Welcome Guest Search | Active Topics | Sign In | Register

Grid Delete using SQL Data Source Options
Posted: Thursday, August 28, 2008 11:36:17 AM
Rank: Member
Groups: Member

Joined: 5/6/2008
Posts: 21
Hi

How could i execute a delete SQL store procedure and send the selected cell as parameter for the procedure, when the user click in the button delete of the column?

Excuse my English... i appreciate your help
eo_support
Posted: Thursday, August 28, 2008 11:50:20 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,091
Hi,

By default the Grid does not go back to the server when you click delete button to delete a row. It remembers all items that have been deleted and when the page finally goes back to the server (by clicking another button, for example), at which time you can use the Grid's DeletedItems to get all deleted items:

http://www.essentialobjects.com/ViewDoc.aspx?t=EO.Web.Grid.DeletedItems.html

You can then loop through that collection and call your SP to delete data from your database.

If you prefer the Grid to postback immediately as soon as user click delete, you can use a ButtonColumn as demonstrated in this sample:

http://www.essentialobjects.com/Demo/Default.aspx?path=Grid\_i1\_i15

You will then need to change the OnItemCommand handler to call this (the code in the sample calls window.alert to display detailed information about the selected item):

Code: JavaScript
grid.raiseItemCommandEvent(itemIndex, "anything");


This will post the page back to the server side and raise ItemCommand event. You would then update your db in ItemCommand event and repopulate the Grid.

Please feel free to let us know if you have any more questions.

Thanks
Posted: Thursday, August 28, 2008 11:56:20 AM
Rank: Member
Groups: Member

Joined: 5/6/2008
Posts: 21
Thank u very much.. It works great!!
Andre
Posted: Friday, September 26, 2008 1:19:43 AM
Rank: Member
Groups: Member

Joined: 8/19/2008
Posts: 14
Hi

Regarding,
grid.raiseItemCommandEvent(itemIndex, "anything");

It fires the event but how do I access the parameter "anything".

I have a delete button and it fires the grid_ItemCommand event, however I want to add more commands i.e. more command buttons that will call this event with different commands.

Thanks
Andre

Andre
Posted: Friday, September 26, 2008 1:21:57 AM
Rank: Member
Groups: Member

Joined: 8/19/2008
Posts: 14

oh and the grid_ItemCommand method is below,

protected void grid_ItemCommand(object sender, eo.GridItemEventArgs e) { }

and I would like to access the parameter "anything" you used in the example above...

Is this possible?

Thanks
Andre
eo_support
Posted: Friday, September 26, 2008 6:38:28 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,091
Hi,

I thought the signature for ItemCommand should be:

protected void grid_ItemCommand(object sender, eo.GridCommandEventArgs e)

GridCommandEventArgs provides CommandName property, which contains "anything".

Thanks
Andre
Posted: Friday, September 26, 2008 7:46:58 AM
Rank: Member
Groups: Member

Joined: 8/19/2008
Posts: 14
you thought correctly, I cant say I have to ever wait for a reply from you guys... 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.