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

Grid No Records found is not displaying when we attach the OnCommand client event handler

1 Answer 35 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tilak
Top achievements
Rank 1
Tilak asked on 26 Apr 2010, 11:17 PM

No records message or template doesn't show when we overide the OnCommand client event handler. It works fine if we remove the GridCommand client event handler.
Below is my simplified code:

ASPX:

<asp:PlaceHolder ID="phGrid" runat="server"></asp:PlaceHolder> 
 
<script type="text/javascript" language="javascript">  
    function GridCommand(sender, args) {  
    }  
</script> 

Code Behind:
RadGrid grid;  
        protected override void OnInit(EventArgs e)  
        {  
            base.OnInit(e);  
            grid = new RadGrid();  
            grid.ID = "grid";  
            grid.NeedDataSource += new GridNeedDataSourceEventHandler(grid_NeedDataSource);  
            grid.ClientSettings.ClientEvents.OnCommand = "GridCommand";  
 
            PopulateGridColumns(grid);  
            phGrid.Controls.Add(grid);  
 
        }  
void grid_NeedDataSource(object source, GridNeedDataSourceEventArgs e)  
        {  
            DataTable dt = new DataTable();  
            grid.DataSource = dt;  
        }  
protected void PopulateGridColumns(RadGrid grid)  
        {  
            List<Field> fields = new List<Field>  
            {  
                new Field { DisplayName = "ID", ColumnName = "ID" },  
                new Field { DisplayName = "Name", ColumnName = "Name" },  
                new Field { DisplayName = "Description", ColumnName = "Description" },  
                new Field { DisplayName = "Location", ColumnName = "Location" },  
                new Field { DisplayName = "Name", ColumnName = "Name" }  
 
            };  
            foreach (var field in fields)  
            {
                #region GridBoundColumns  
                GridBoundColumn col = new GridBoundColumn();  
                grid.MasterTableView.Columns.Add(col);  
                col.DataField = field.ColumnName;  
                col.HeaderText = field.DisplayName;  
                if (field.ColumnName == "ID")  
                    col.DataType = Type.GetType("System.Int32");
                #endregion  
            }  
        }  
 
[Serializable]  
    public class Field  
    {  
        public String ColumnName { getset; }  
        public String DisplayName { getset; }  
    } 

Please let me know if this an issue with the RadGrid control. Also note this is a simplified version I posted here.

Thanks,
Tilak

1 Answer, 1 is accepted

Sort by
0
Pavel
Telerik team
answered on 28 Apr 2010, 11:10 AM
Hi Tilak,

This issue existed in one of the older version of the controls. Please update to the latest release in order to address it. You can find more details on how to upgrade in the following article:
http://www.telerik.com/support/kb/aspnet-ajax/general/updating-radcontrols-for-asp-net-to-another-version-or-license.aspx

Kind regards,
Pavel
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
Tilak
Top achievements
Rank 1
Answers by
Pavel
Telerik team
Share this question
or