|
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
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
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.htmlYou 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\_i15You 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
|
|
Rank: Member Groups: Member
Joined: 5/6/2008 Posts: 21
|
Thank u very much.. It works great!!
|
|
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
|
|
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
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
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
|
|
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
|
|