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

[Solved] RadGrid Filter Menu Not Showing with untyped DataSet

1 Answer 235 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 01 Nov 2011, 09:08 PM
Hi,

I am binding a ASP.NET AJAX RADGrid to a dynamic datatable that is part of a dataset. The datatable is filled by a Stored Procedure. The returned datatable column names, column data types, and the number of columns is unknown until run time. So, essentially the grid has no idea what to expect. The Stored Porcedure takes an ID and a date range as parameters. The column headers are survey questions and the rows contain the answers. The survey questions vary from survey to survey, thus the column name, number, and data type are unknown.
 
The grid loads fine but all the column Filter Option Menus do not show up. My first test brought back 5 columns and only the last column had a filter menu. My next test for another survey brought back 25 columns and the first two and last column had a filter menu while the rest did not.

I tried testing the grid with a known data structure and the filter menus showed up as they should, so, I am guessing that the problem has something to do with my dynamic datatable. I have tried a number of grid settings and configurations but nothing works. Among other things, I have tried adding the columns programmatically and setting the column datatype to string - didn't work.

I am working with the most recent version of the Telerik ASP.NET AJAX Controls. I just did the download and install today.

Please help me figure out how to get all the Filter Menus to show,

Eric

My most recent code is below:

protected void Page_Load(object sender, EventArgs e)
        {
            DateTime start = new DateTime(2009, 10, 1, 0, 0, 0);
            DateTime end = new DateTime(2012, 10, 1, 0, 0, 0);
            BusinessObject.Objects.Survey svy = new BusinessObject.Objects.Survey();
            DataSet ds = new DataSet();
            ds = BusinessObject.Objects.Survey.GetSurveyDetailsBySurveyId("233", start, end);
            RadGrid1.MasterTableView.DataSource = ds.Tables[0];
        }


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test2.aspx.cs" Inherits="MoZeus.Report.Web.WebRole.ReportViewer.test2" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title>kjggkgjh</title>
 
</head>
<body>
    <form id="form1" runat="server">
     <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
    </telerik:RadScriptManager>
        
        <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
     <div class="dvGrid" id="dvGrid" style="width:1000px">
     <telerik:RadGrid ID="RadGrid1" OnNeedDataSource="RadGrid1_NeedDataSource" AllowSorting="True" AllowPaging="True" PageSize="20"
                    runat="server" Width="1000px" Height="600px" AllowFilteringByColumn="True"
                   AutoGenerateColumns="true" ShowStatusBar="true" Skin="Black" 
                    AllowAutomaticUpdates="true" AllowAutomaticInserts="true" ShowHeader="true"
                    OnItemDataBound="RadGrid1_ItemDataBound" OnPreRender="RadGrid1_PreRender"
                    AllowMultiRowEdit="true" HeaderStyle-HorizontalAlign="Center"
                    EnableAjaxSkinRendering="true" ShowHeadersWhenNoRecords="true"
                      EnableNoRecordsTemplate="true" OnItemCommand="RadGrid1_ItemCommand"  ShowFooter="true"  EnableLinqExpressions="false">
                    <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
                    </HeaderContextMenu>                   
                    <PagerStyle Mode="NextPrevAndNumeric" Position="TopAndBottom"></PagerStyle>
                    <MasterTableView EditMode="InPlace" ShowFooter="true" AutoGenerateColumns="true" 
                    CommandItemDisplay="TopAndBottom" EnableNoRecordsTemplate="true" GridLines="None"  AllowFilteringByColumn="true">
                     <NoRecordsTemplate>No records found.</NoRecordsTemplate>
                        <CommandItemTemplate>
                            <div style="padding: 5px 5px;text-align:right;">
                                <asp:LinkButton ID="btnRebind" runat="server" CommandName="RebindGrid">
                                <img style="border:0px;vertical-align:middle;" alt="" src="img/Refresh.gif" />Refresh</asp:LinkButton>
                            </div>
                        </CommandItemTemplate>
                        <Columns>
                        </Columns>
                    </MasterTableView>
                    <ClientSettings>
                        <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                    </ClientSettings>
                    <FilterMenu EnableImageSprites="False">
                    </FilterMenu>
                </telerik:RadGrid>
        </div>    
         
        </telerik:RadAjaxPanel>
    </form>
</body>
</html>

1 Answer, 1 is accepted

Sort by
0
Eric
Top achievements
Rank 1
answered on 02 Nov 2011, 03:22 PM
I finally figured it out. Some of the survey questions/prompts used for the column headers had a special character in them like a semicolon. For some reason, the grid doesn't seem to like semicolons and I am not sure if it is the column headertext or the datafield property that is the problem.

The grid doesn't seem to mind having a question mark as part of the column name and it doesn't seem to mind spaces either.

It is embarassing to admit how much time I spent chasing this down but let's say it was considerable. I hope this helps anyone who runs into this in the future and saves them time and frustration.


Eric
Tags
Grid
Asked by
Eric
Top achievements
Rank 1
Answers by
Eric
Top achievements
Rank 1
Share this question
or