This is a migrated thread and some comments may be shown as answers.

Update event not firing

3 Answers 61 Views
Grid
This is a migrated thread and some comments may be shown as answers.
RB
Top achievements
Rank 1
RB asked on 11 Jun 2014, 10:41 PM
I have a RadGrid with the following properties:
this._RadGrid1.ID = "RadGrid1";
this._RadGrid1.AllowAutomaticDeletes = false;
this._RadGrid1.AllowAutomaticInserts = false;
this._RadGrid1.AllowAutomaticUpdates = false;        
this._RadGrid1.AllowMultiRowSelection = true;                        
this._RadGrid1.MasterTableView.NoMasterRecordsText = "No BAN Assignments found";
  //Adding Columns//
 GridEditCommandColumn gridEditCommandColumn = new GridEditCommandColumn();
 gridEditCommandColumn.UniqueName = "GridEditCommandColumn";
 this._RadGrid1.MasterTableView.Columns.Add(gridEditCommandColumn);
 this._RadGrid1.MasterTableView.EditMode = GridEditMode.InPlace;                   
 
this._RadGrid1.MasterTableView.DataKeyNames = new string[] { tis._PriceDealProductBanTable.PriceDealEntityProductItemIdColumn.ColumnName };
this._RadGrid1.MasterTableView.ClientDataKeyNames = new string[] { this._PriceDealProductBanTable.PriceDealEntityProductItemIdColumn.ColumnName };          
this._RadGrid1.UpdateCommand += RadGrid1_UpdateCommand;
this._RadGrid1.NeedDataSource += RadGrid1_NeedDataSource;
 
protected void RadGrid1_UpdateCommand(object source, GridCommandEventArgs e)
 {           
            var xmlBuilder = new System.Text.StringBuilder();           
                    
            }

The UpdateCommand is not being fired!

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 12 Jun 2014, 07:29 AM
Hi,

I tried your code and it works fine at my end. Please provide your full code snippet. Meanwhile check with this documentation if you have created the Grid correctly.
Creating a RadGrid Programmatically

Thanks,
Princy
0
RB
Top achievements
Rank 1
answered on 12 Jun 2014, 10:13 PM
class AssignBanGridCtrl : WebControl
    {
        #region Fields
        private RadAjaxLoadingPanel _RadLoadingPanel = new RadAjaxLoadingPanel();
        private RadAjaxPanel _RadAjaxPanel = new RadAjaxPanel();
        private RadGrid _RadGrid1 = new RadGrid();    
        private PriceDealProductBanTable _PriceDealProductBanTable = new PriceDealProductBanTable();
        private PriceDealProposal _Proposal = null;   
        private bool _HasOrderRequest = false;
        private GXButton _btnCopyToSelect=new GXButton();
        private GXButton _btnSaveSelected=new GXButton();
        private GXTextBox _TbBAN = new GXTextBox();
 
        private bool _IsSupplementOrChangeQuote;
 
        #endregion
 
         #region Constructors
 
        public AssignBanGridCtrl(PriceDealProposal proposal, bool hasOrderRequest)
            : base()
        {
            this._Proposal = proposal;
            this._HasOrderRequest = hasOrderRequest;
        }
        public AssignBanGridCtrl(PriceDealProposal proposal, bool hasOrderRequest, bool IsSupplementOrChangeQuote)
            : base()
        {
            this._Proposal = proposal;
            this._HasOrderRequest = hasOrderRequest;
            this._IsSupplementOrChangeQuote = IsSupplementOrChangeQuote;
        }
 
        #endregion
 
       #region Overrides
 
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            LoadBANList();
          
            this._RadLoadingPanel.ID = "_RadLoadingPanel";
            this._RadLoadingPanel.Transparency = 30;
            this._RadLoadingPanel.Skin = "WebBlue";
            this._RadLoadingPanel.BackgroundPosition = AjaxLoadingPanelBackgroundPosition.Center;
 
 
            #region Grid1
            RadGridProperties radProps = new RadGridProperties(this._RadGrid1);
            this._RadGrid1.ID = "RadGrid1";
            this._RadGrid1.AllowAutomaticDeletes = false;
            this._RadGrid1.AllowAutomaticInserts = false;
            this._RadGrid1.AllowAutomaticUpdates = false;
            this._RadGrid1.ClientSettings.Selecting.AllowRowSelect = true;
            this._RadGrid1.AllowMultiRowSelection = true;               
            //this._RadGrid1.ClientSettings.ClientEvents.OnRowSelected = "OnRowSelected";
            //this._RadGrid1.ClientSettings.ClientEvents.OnCommand = "function(){}";
            this._RadGrid1.MasterTableView.NoMasterRecordsText = "No BAN Assignments found";
                                 
            this._RadGrid1.MasterTableView.DataKeyNames = new string[] { this._PriceDealProductBanTable.PriceDealEntityProductItemIdColumn.ColumnName };
            this._RadGrid1.MasterTableView.ClientDataKeyNames = new string[] { this._PriceDealProductBanTable.PriceDealEntityProductItemIdColumn.ColumnName };           
            this._RadGrid1.UpdateCommand += RadGrid1_UpdateCommand;
            this._RadGrid1.ItemDataBound += RadGrid1_ItemDataBound;
            this._RadGrid1.NeedDataSource += RadGrid1_NeedDataSource;
           
                        
            #region Columns
                      
            GridBoundColumn boundColumn = new GridBoundColumn();
            string columnName;
 
            GridClientSelectColumn selectall = new GridClientSelectColumn();
            selectall.UniqueName = "SelectOne";
             
            this._RadGrid1.MasterTableView.Columns.Add(selectall);
 
            string templateColumnName;
            GridTemplateColumn templateColumn = new GridTemplateColumn();           
                    
            columnName = this._PriceDealProductBanTable.DescriptionColumn.ColumnName; ;
            boundColumn = new GridBoundColumn();
            this._RadGrid1.MasterTableView.Columns.Add(boundColumn);           
            boundColumn.DataField = columnName;
            boundColumn.HeaderText = "Location";
            boundColumn.ReadOnly = true;
            boundColumn.AllowFiltering = false;
 
            columnName = this._PriceDealProductBanTable.CatalogProductColumn.ColumnName;
            boundColumn = new GridBoundColumn();
            this._RadGrid1.MasterTableView.Columns.Add(boundColumn);
            boundColumn.FilterTemplate = new DropdownTemplate(columnName, _RadGrid1, this._PriceDealProductBanTable.SelectDistinct(columnName));
            boundColumn.DataField = columnName;
            boundColumn.HeaderText = "Product";
            boundColumn.ReadOnly = true;
            boundColumn.AllowFiltering = true;
 
            columnName = this._PriceDealProductBanTable.CountryColumn.ColumnName;
            boundColumn = new GridBoundColumn();
            boundColumn.FilterTemplate = new DropdownTemplate(columnName, _RadGrid1, this._PriceDealProductBanTable.SelectDistinct(columnName));
            this._RadGrid1.MasterTableView.Columns.Add(boundColumn);
            boundColumn.DataField = columnName;
            boundColumn.ReadOnly = true;
            boundColumn.HeaderText = "Country";
 
            columnName = this._PriceDealProductBanTable.StateColumn.ColumnName; 
            boundColumn = new GridBoundColumn();
            boundColumn.FilterTemplate = new DropdownTemplate(columnName, _RadGrid1,      this._PriceDealProductBanTable.SelectDistinct(columnName));
            this._RadGrid1.MasterTableView.Columns.Add(boundColumn);
            boundColumn.HeaderText = "State/Province";
            boundColumn.ReadOnly = true;
            boundColumn.DataField = columnName;
 
           
            #endregion
            #endregion        
                        
            this._RadAjaxPanel.Controls.Add(this._RadLoadingPanel);
            this._RadAjaxPanel.Controls.Add(this._RadGrid1);
     
            this._btnSaveSelected.ID = "BtSaveToSelected";
            this._btnSaveSelected.Text = "Save Selected";
            this._btnSaveSelected.CssClass = "GxButtonBlue";
            this._btnSaveSelected.Click += new EventHandler(BtSaveToSelected_Click);
            this._RadAjaxPanel.Controls.Add(this._btnSaveSelected);            
 
            this.Controls.Add(this._RadAjaxPanel);
         
        }
 
        protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
        {
             
        }
        protected void RadGrid1_UpdateCommand(object source, GridCommandEventArgs e)
        {           
            var xmlBuilder = new System.Text.StringBuilder();           
     
        }     
 
        private void BtnCopyToSelected_Click(object sender, EventArgs e)
        {                      
                 
                 
            
      
 
     #endregion
        void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
 
            LoadBANList();
            this._RadGrid1.DataSource = this._PriceDealProductBanTable;
        }
 
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            RadAjaxManager ajaxManager = RadAjaxManager.GetCurrent(Page);
            ajaxManager.AjaxSettings.AddAjaxSetting(this._RadAjaxPanel, this._RadGrid1, this._RadLoadingPanel);   
 
        }
        
        private void LoadBANList()
        {
            this._PriceDealProductBanTable = new PriceDealEntityProductItem().ExecuteTypedDataTable();
        }
    } 
}
this._RadGrid1.UpdateCommand += RadGrid1_UpdateCommand; should do the trick, but still the Update event is not fired!
0
Eyup
Telerik team
answered on 16 Jun 2014, 12:46 PM
Hello Ruchi,

I suggest that you open a formal support ticket and send us a very basic runnable web site demonstrating the problematic behavior. Thus, we will be able to further analyze and debug the project and try to determine the cause of the issue.

Regards,
Eyup
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
RB
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
RB
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or