Hi,
In order to delete an item on the client side, you can call this function:
http://doc.essentialobjects.com/library/1/jsdoc.public.grid.deleteitem.aspxThe key for the grid to fire server event is this function:
http://doc.essentialobjects.com/library/1/jsdoc.public.grid.raiseitemcommandevent.aspxCalling this function on the client side will post back the page and raises server side ItemCommand event. So it should be something like this:
Code: HTML/ASPX
<a href="javascript:deleteAndPostBack(0);">Delete first item!</a>
Code: JavaScript
function deleteAndPostBack(itemIndex)
{
//Get the Grid object
var grid = eo_GetObject("Grid1");
//Delete the item
grid.deleteItem(itemIndex);
//Post back and raises ItemCommand event
//with a unique command name
grid.raiseItemCommandEvent(itemIndex, "Whatever");
}
You can also use a DeleteCommandColumn in the Grid, so that you do not have to call grid.deleteItem. In that case you will need to handle the Grid's ClientSideOnItemCommand event:
http://doc.essentialobjects.com/library/1/eo.web.grid.clientsideonitemcommand.aspxThe code will be something like this:
Code: HTML/ASPX
<eo:Grid ClientSideOnItemCommand="on_item_command" ....>
.....
</eo:Grid>
Code: JavaScript
function on_item_command(grid, itemIndex, colIndex, commandName)
{
//Note: Here commandName will always be "Delete", not "Whatever"
grid.raiseItemCommandEvent(itemIndex, commandName);
}
On the server side you will handle the Grid's ItemCommand event and the
code will be something like this:
Code: Visual Basic.NET
'Check the command name to see if it was
'from our client side code. If it is, then delete
'the same item from Grid2
If e.CommandName = "Whatever" Then
Grid2.Items.RemoveAt(e.Item.Index)
End If
Hope this helps.
Thanks!