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

RadGrid not visible

1 Answer 7 Views
Grid
This is a migrated thread and some comments may be shown as answers.
RB
Top achievements
Rank 1
RB asked on 15 May 2014, 10:46 PM
I have a simple rad grid as follows:
class AssignBanGridCtrl : WebControl
   {
       #region Fields
       private RadAjaxLoadingPanel _RadLoadingPanel = new RadAjaxLoadingPanel();
       private UpdatePanel _UpdatePanel = new UpdatePanel();
       private RadGrid _RadGrid1 = new RadGrid();   
       private PriceDealProductBanTable _PriceDealProductBanTable = new PriceDealProductBanTable();
       private PriceDealProposal _Proposal = null;  
       private bool _HasOrderRequest = false;         
       #endregion
  
        #region Constructors
  
       public AssignBanGridCtrl(PriceDealProposal proposal, bool hasOrderRequest)
           : base()
       {
       }
  
       #endregion
  
      #region Overrides
  
       protected override void OnInit(EventArgs e)
       {
           base.OnInit(e);
  
           this._RadLoadingPanel.ID = "_RadLoadingPanel";
           this._RadLoadingPanel.Transparency = 30;
           this._RadLoadingPanel.Skin = "WebBlue";
           this._RadLoadingPanel.BackgroundPosition = AjaxLoadingPanelBackgroundPosition.Center;
  
           #region Grid1
           this._RadGrid1.ID = "_RadGrid1";
           this._RadGrid1.Skin = "WebBlue";
           this._RadGrid1.Width = Unit.Percentage(100);
           this._RadGrid1.GridLines = GridLines.None;
           this._RadGrid1.PageSize = 20;
           this._RadGrid1.AllowPaging = false;
           this._RadGrid1.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric;
           this._RadGrid1.AllowSorting = true;
           this._RadGrid1.AutoGenerateColumns = false;
           this._RadGrid1.EnableLinqExpressions = false;
           this._RadGrid1.ShowGroupPanel = false;
           this._RadGrid1.ShowStatusBar = true;
           this._RadGrid1.GroupingEnabled = true;
           this._RadGrid1.ClientSettings.DataBinding.EnableCaching = true;
           this._RadGrid1.MasterTableView.Width = Unit.Percentage(100);
           this._RadGrid1.MasterTableView.Caption = "BAN List";
           this._RadGrid1.MasterTableView.EnableHeaderContextMenu = true;
           this._RadGrid1.MasterTableView.NoMasterRecordsText = "No Locations found";
  
           this._RadGrid1.NeedDataSource += RadGrid1_NeedDataSource;
             
  
           this._RadGrid1.MasterTableView.DataKeyNames = new string[] { this.xyz.ColumnName };
             
           #region Columns
           GridBoundColumn boundColumn = new GridBoundColumn();          
           this._RadGrid1.MasterTableView.Columns.Add(boundColumn);
           boundColumn.DataField = this.xyz.ColumnName;;
           boundColumn.HeaderText = "Product";
  
           boundColumn = new GridBoundColumn();
           this._RadGrid1.MasterTableView.Columns.Add(boundColumn);
           boundColumn.DataField = this.xyz.ColumnName;
           boundColumn.HeaderText = "Location";
             
           #endregion
  
           #endregion
  
           this._UpdatePanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
           this._UpdatePanel.ContentTemplateContainer.Controls.Add(this._RadLoadingPanel);
           this._UpdatePanel.ContentTemplateContainer.Controls.Add(this._RadGrid1);
           this.Controls.Add(this._UpdatePanel);
         
       }
      
    #endregion
       void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
       {  
           this.xyz= new DealId().ExecuteTypedDataTable(this._Proposal.PriceDealId);  
       }
  
       protected override void OnPreRender(EventArgs e)
       {
           base.OnPreRender(e);  
       }
   }

But this grid is not visible!
I can see that the grid is populated but still not visible. On debugging i see the grid being rendered as follows:

<div class="RadGrid RadGrid_WebBlue" id="OrderBaseCtrl_GXHyperLinkTab_ctl00_FsMain_ProposalDealBANCtrl_FsMain__RadGrid1" style="width: 100%;">
On comparision with other grids, i noticed that this <div> does not have a <table>.
PLease help me.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 16 May 2014, 04:55 AM
Hi,

You have to place the UpdatePanel inside a form tag. Please add the Control to form and see if the Grid is displayed.
C#:
_UpdatePanel.ID = "_UpdatePanel";
this._UpdatePanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
this._UpdatePanel.ContentTemplateContainer.Controls.Add(this._RadLoadingPanel);
this._UpdatePanel.ContentTemplateContainer.Controls.Add(this._RadGrid1);
Form.Controls.Add(this._UpdatePanel);

Thanks,
Princy
Tags
Grid
Asked by
RB
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Share this question
or