Aspose.Cells.GridWeb.Examples.CSharp.Miscellaneous.DataSourceControl.BindWithDataSourceControl.GridWeb1_CustomCommand C# (CSharp) Méthode

GridWeb1_CustomCommand() protected méthode

protected GridWeb1_CustomCommand ( object sender, string command ) : void
sender object
command string
Résultat void
        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;
            }
        }