protected void GridWeb1_CustomCommand(object sender, string command)
{
switch (command)
{
case "UPDATE":
// Only available for local users.
if (Request.UserHostAddress == "127.0.0.1")
{
// Update datasource
GridWeb1.WebWorksheets[0].DataSourceControlUpdate(AccessDataSource1);
}
else
{
// Set error message
ShowErrorMsg("Can't update from remote machine!");
}
break;
case "ADD":
if (GridWeb1.ActiveSheetIndex == 0)
{
// Bind to new active row
GridWeb1.WebWorksheets.ActiveSheet.CreateNewBindRow();
// Scrolls the panel to the bottom.
GridWeb1.ViewPanelScrollTop = int.MaxValue.ToString();
}
break;
case "DELETE":
if (GridWeb1.ActiveSheetIndex == 0)
{
if (GridWeb1.ActiveCell != null)
// Delete active row
GridWeb1.WebWorksheets.ActiveSheet.DeleteBindRow(GridWeb1.ActiveCell.Row);
}
break;
}
}