Dropdown Filter

2 posts, 1 answers
  1. Allan
    Allan avatar
    121 posts
    Member since:
    Jun 2008

    Posted 23 Feb 2009 Link to this post

    I am rather new to programming, but I just can't believe that something so basic and requested very frequently here in the forums should be so hard to implement.

    I have tried every example for adding a dropdown box to the AJAX Grid with none of them really working including:
    http://www.telerik.com/help/aspnet-ajax/grdfilteringwithdropdownlist.html

    I am using Visual Studio 2008 and SQL 2005. I am programming in VB.

    I created the custom class as outlined in the above sample, but it has an error in the line:

    If Me.DataType = GetType("System.Int32") OrElse Me.DataType = GetType("System.Int16") OrElse Me.DataType = GetType("System.Int64") Then

    filterItem.FireCommandEvent("Filter", New Pair("EqualTo", Me.UniqueName))

    The error states "Type expected".

    Is there a CLEAR example for this using VB and SQL?

    If not, could I get some help creating one to add here to the forum so we can all share it?

    Here is my ASPX page.

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Copy of company_revenue.aspx.vb" Inherits="admin_accounting_reports_company_company_revenue" %> 
     
    <%@ 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>Untitled Page</title> 
    </head> 
    <body> 
        <p> 
            <img alt="" src="../../../../images/Header.gif"   
                style="width: 950px; height: 54px" /></p>  
        <style="color: #638AB0; font-weight: 700; font-family: Arial; font-size: large">  
            New Report Model</p> 
        <form id="form1" runat="server">  
        <telerik:RadScriptManager ID="ScriptManager1" runat="server"   
            EnableTheming="True">  
        </telerik:RadScriptManager> 
        <telerik:RadGrid ID="RadGrid1" runat="server"   
            DataSourceID="Revenue" GridLines="None" EnableLinqExpressions="False"   
            Font-Bold="False" Font-Italic="False" Font-Names="Arial" Font-Overline="False"   
            Font-Size="XX-Small" Font-Strikeout="False" Font-Underline="False"   
            ForeColor="Blue" ShowFooter="True" Skin="WebBlue"   
            AllowFilteringByColumn="True">  
    <MasterTableView ShowGroupFooter="true" autogeneratecolumns="False" datasourceid="Revenue"   
                datakeynames="IDShpmt" groupsdefaultexpanded="False"   
                filterexpression="([ModifiedDate] =' 01/01/2100')">  
    <RowIndicatorColumn Visible="False">  
    <HeaderStyle Width="20px"></HeaderStyle> 
    </RowIndicatorColumn> 
     
    <ExpandCollapseColumn Visible="False" Resizable="False">  
    <HeaderStyle Width="20px"></HeaderStyle> 
    </ExpandCollapseColumn> 
     
        <Columns> 
            <telerik:GridBoundColumn DataField="IDShpmt" DataType="System.Int32"   
                HeaderText="Shpmt" ReadOnly="True" SortExpression="IDShpmt"   
                UniqueName="IDShpmt" AllowFiltering="False" AutoPostBackOnFilter="True">  
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="ModifiedDate"   
                DataFormatString="{0:MM/dd/yyyy}" DataType="System.DateTime"   
                HeaderText="Completed Date" ReadOnly="True" SortExpression="ModifiedDate"   
                UniqueName="ModifiedDate">  
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="Contractor"   
                HeaderText="Contractor" SortExpression="Contractor"   
                UniqueName="Contractor">  
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn Aggregate="Sum" DataField="RevenueTotal"   
                DataFormatString="{0:C2}" DataType="System.Decimal"   
                FooterAggregateFormatString="{0:C2}" HeaderText="Base Revenue" ReadOnly="True"   
                SortExpression="RevenueTotal" UniqueName="RevenueTotal"   
                AllowFiltering="False">  
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn Aggregate="Sum" DataField="AdtlItemTotal"   
                DataFormatString="{0:C2}" DataType="System.Decimal"   
                FooterAggregateFormatString="{0:C2}" HeaderText="Adtl. Item Revenue"   
                ReadOnly="True" SortExpression="AdtlItemTotal" UniqueName="AdtlItemTotal"   
                AllowFiltering="False">  
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn Aggregate="Sum" DataField="ShpmtTotal"   
                DataFormatString="{0:C2}" DataType="System.Decimal"   
                FooterAggregateFormatString="{0:C2}" HeaderText="Total Revenue" ReadOnly="True"   
                SortExpression="ShpmtTotal" UniqueName="ShpmtTotal" AllowFiltering="False">  
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn Aggregate="Sum" DataField="CompanyRevenue"   
                DataFormatString="{0:C2}" DataType="System.Decimal"   
                FooterAggregateFormatString="{0:C2}" HeaderText="Company Revenue"   
                ReadOnly="True" SortExpression="CompanyRevenue"   
                UniqueName="CompanyRevenue" AllowFiltering="False">  
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn Aggregate="Sum" DataField="ContractorFirstItemTotal"   
                DataFormatString="{0:C2}" DataType="System.Decimal"   
                FooterAggregateFormatString="{0:C2}" HeaderText="Cont. Base Revenue"   
                ReadOnly="True" SortExpression="ContractorFirstItemTotal"   
                UniqueName="ContractorFirstItemTotal" AllowFiltering="False">  
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn Aggregate="Sum" DataField="ContractorAddItemTotal"   
                DataFormatString="{0:C2}" DataType="System.Decimal"   
                FooterAggregateFormatString="{0:C2}" HeaderText="Cont AdtI. Item Revenue"   
                ReadOnly="True" SortExpression="ContractorAddItemTotal"   
                UniqueName="ContractorAddItemTotal" AllowFiltering="False">  
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn Aggregate="Sum" DataField="Bonus"   
                DataFormatString="{0:C2}" DataType="System.Decimal"   
                FooterAggregateFormatString="{0:C2}" HeaderText="Cont. Bonus" ReadOnly="True"   
                SortExpression="Bonus" UniqueName="Bonus" AllowFiltering="False">  
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn Aggregate="Sum" DataField="ContractorTotal"   
                DataFormatString="{0:C2}" DataType="System.Decimal"   
                FooterAggregateFormatString="{0:C2}" HeaderText="Contractor Total"   
                ReadOnly="True" SortExpression="ContractorTotal"   
                UniqueName="ContractorTotal" AllowFiltering="False">  
            </telerik:GridBoundColumn> 
        </Columns> 
        <groupbyexpressions> 
            <telerik:GridGroupByExpression> 
                <selectfields> 
                    <telerik:GridGroupByField Aggregate="None" FieldAlias="Contractor"   
                        FieldName="Contractor" FormatString="" HeaderText="" /> 
                </selectfields> 
                <groupbyfields> 
                    <telerik:GridGroupByField FieldAlias="Contractor" FieldName="Contractor"   
                        FormatString="" HeaderText="" /> 
                </groupbyfields> 
            </telerik:GridGroupByExpression> 
        </groupbyexpressions> 
     
    <EditFormSettings> 
    <PopUpSettings ScrollBars="None"></PopUpSettings> 
    </EditFormSettings> 
        <HeaderStyle BackColor="Blue" Font-Bold="False" Font-Italic="False"   
            Font-Overline="False" Font-Strikeout="False" Font-Underline="False"   
            ForeColor="White" Wrap="True" /> 
        <FooterStyle Font-Bold="True" Font-Size="Small" /> 
    </MasterTableView> 
            <HeaderStyle BackColor="Blue" Font-Bold="False" Font-Italic="False"   
                Font-Overline="False" Font-Strikeout="False" Font-Underline="False"   
                Wrap="True" /> 
        </telerik:RadGrid> 
        <br /> 
        <br /> 
        <br /> 
        <br /> 
        <br /> 
        <asp:SqlDataSource ID="Revenue" runat="server"   
            ConnectionString="<%$ ConnectionStrings:smsConnectionString %>"   
              
              
              
              
              
            SelectCommand="SELECT [IDShpmt], CAST([EnterDate] AS DateTime) AS EnterDate, [ModifiedDate], [Contractor], [RevenueTotal], [ShpmtTotal], [AdtlItemTotal], [CompanyRevenue], [ContractorFirstItemTotal], [ContractorAddItemTotal], [Bonus],   [ContractorTotal] FROM [Report_Revenue_Totals]   
    WHERE [Status] = 'Completed'"> 
        </asp:SqlDataSource> 
        </form> 
        <p> 
            &nbsp;</p> 
        <p> 
            &nbsp;</p> 
        <p> 
            &nbsp;</p> 
    </body> 
    </html> 
     

    I am using SQL as my data base with the conection string in the web.config file as 'smsConnectionString'.

    The table and fileds are in the SQL command statement in the ASPX file.

    Thank you in advance for any help.
  2. Answer
    Yavor
    Admin
    Yavor avatar
    11 posts

    Posted 26 Feb 2009 Link to this post

    Hi Allan,

    Attached to this message, is a small application, which handles a functionality close to the one that you mentioned. I hope it helps.

    Best wishes,
    Yavor
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top