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

Problem with filtering

4 Answers 100 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rahul Khinvasara
Top achievements
Rank 1
Rahul Khinvasara asked on 28 Aug 2008, 01:28 PM
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

4 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 28 Aug 2008, 04:10 PM
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.
0
Rahul Khinvasara
Top achievements
Rank 1
answered on 29 Aug 2008, 05:56 AM
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

0
Daniel
Telerik team
answered on 01 Sep 2008, 02:08 PM
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.
0
Shinu
Top achievements
Rank 2
answered on 02 Sep 2008, 04:36 AM
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.
Tags
Grid
Asked by
Rahul Khinvasara
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Rahul Khinvasara
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or