Problem with filtering

5 posts, 0 answers
  1. Rahul Khinvasara
    Rahul Khinvasara avatar
    303 posts
    Member since:
    Aug 2007

    Posted 28 Aug 2008 Link to this post

    Hi,

                  I am using filtering functionality. I have set AllowFilteringByColumn="True" Still the filtering is not working.

    I have binded the grid in page load event.

    If I write the binding code in not ispostback then the grid does not appears after the filtering is done.

    If I write the code in postback event of page load grid appears but without filtered data.

    Please tell me which property should I set or I am doing binding of grid in some wrong event. Shall I bind grid in event other than page load?

    Thanks,
    Rahul
  2. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 28 Aug 2008 Link to this post

    Hello Rahul,

    Built-in filtering feature is not supported with simple data-binding (calling DataBind()). See the Simple data binding demo from the Populating with data section for more info about the limitations of this binding mode.

    This link can be useful: Advanced Data-binding (using NeedDataSource event)

    Regards,
    Daniel
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Rahul Khinvasara
    Rahul Khinvasara avatar
    303 posts
    Member since:
    Aug 2007

    Posted 29 Aug 2008 Link to this post

    Hi,
             I have written the binding code in need datasource as follows:

               DataSet ds = new DataSet();
                ds = objCntl.Proc_GetUserList();
                grdUserProfile.DataSource = ds;

    In aspx page my code is as:

    <telerik:RadGrid ID="grdUserProfile" runat="server"
                            AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True"
                            AutoGenerateColumns="False" GridLines="None"
                            onitemdatabound="grdUserProfile_ItemDataBound"
                            onpageindexchanged="grdUserProfile_PageIndexChanged"
                    Skin="Office2007" ondeletecommand="grdUserProfile_DeleteCommand"
                    onneeddatasource="grdUserProfile_NeedDataSource" >
                  
                            <MasterTableView DataKeyNames="ID" >
                                <RowIndicatorColumn Visible="False">
                                    <HeaderStyle Width="20px" />
                                </RowIndicatorColumn>
                                <ExpandCollapseColumn Resizable="False" Visible="False">
                                    <HeaderStyle Width="20px" />
                                </ExpandCollapseColumn>
                                <Columns>
                               
                                    <telerik:GridBoundColumn DataField="ID" HeaderText="ID" UniqueName="ID"
                                        Visible="true">
                                    </telerik:GridBoundColumn>
                                   
                                      <telerik:GridTemplateColumn HeaderText="Users"
                                        UniqueName="ContactName">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="ContactName" runat="server" CommandName="delete" Text='<%# DataBinder.Eval(Container.DataItem, "ContactName") %>'></asp:LinkButton>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                  
                                </Columns>
                                <EditFormSettings>
                                    <PopUpSettings ScrollBars="None" />
                                </EditFormSettings>
                            </MasterTableView>
                            <PagerStyle Mode="NextPrevAndNumeric" />
                        </telerik:RadGrid>

    The grid is dispalyed correctly. However when I am filtering the column "ContactName" I am getting error :
    is neither a DataColumn nor a DataRelation for table Table.

    If I bind the ContactName in telerik:GridBoundColumn it is working properly.
    However if the ContactName is in GridTemplateColumn it gives the above error. Is it so that filtering does not works for item template field?

    Thanks,
    Rahul

  5. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 01 Sep 2008 Link to this post

    Hello Rahul,

    Please examine the help topic shown below:
    Implementing filtering for template/custom columns

    If you still experience troubles with this matter please attach simple runnable version of your project to a regular support ticket in order to examine it locally.





    Kind regards,
    Daniel
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 01 Sep 2008 Link to this post

    Hi Rahul,

    In the your aspx you have not set the DataField property and AllowFiltering property for the Template Column. Try setting it as shown below.

    ASPX:
    <telerik:GridTemplateColumn AllowFiltering="true" DataField="ContactName" HeaderText="Users" UniqueName="ContactName"
                  <ItemTemplate> 
                    <asp:LinkButton ID="ContactName" runat="server" CommandName="delete" Text='<%# DataBinder.Eval(Container.DataItem, "ContactName") %>'></asp:LinkButton> 
                 </ItemTemplate> 
         </telerik:GridTemplateColumn> 



    Thanks
    Shinu.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017