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:
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"><html xmlns="http://www.w3.org/1999/xhtml"><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>