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

GridBoundColumn filtering does not show any results

4 Answers 103 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Preetham
Top achievements
Rank 2
Preetham asked on 22 Aug 2012, 10:11 AM
Hi Team,

I have a peculiar problem and I am not sure if anyone had come across this problem earlier. however the issue goes like this..

I have a grid with combination of TemplateColumns and BoundColumns and when I filter the grid using the filters under template columns I can see the results in UI (grid) but when I do the same in BoundColumns I do not see any results.. !!!

Funny thing is I can see the output from the query and its returns the correct number of results from DB. and its also assigned to the GridDataSource in the NeedDataSource event. however I cannot find the GridDataItem in the ItemDataBoundItem, I can fetch only headeritem, filteritem and footeritem.

It shows "No records to display" even when there are lot of records assigned to the DataSource.
Here I am attaching the screenshot, where you can see that the records count is displayed but not the records.. !!

Any help is highly appreciated.

Thanks,
Preetham.

4 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 24 Aug 2012, 08:35 AM
Hello Preetham,

I have created a sample RadGrid web site to test the described behavior. On my side everything works as expected and the GridBoundColumns are being successfully filtered as well as any other column. Please check out the attached application and try to distinguish the crucial differences between our projects.

Kind regards,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Preetham
Top achievements
Rank 2
answered on 24 Aug 2012, 09:47 AM
Hi Eyup,

Thanks for the investing some time on this query and creating a sample code for me, really appreciate it.

However, I have been using Telerik Grids from a long time and also a created many of them with both TemplateColumns and Bound Columns and all of them work fine while filtering and sorting and pagination as well, but I have never come across this kind of issue where in the filtering fails only when we do it on a BoundColumn.
Actually we are not using Template and Bound columns directly in our application,here we are creating more classes that inherit from them as per our requirement and all of the grid work fine but this particular scenario

Here we have the grid inside a RadAjaxPanel if that makes any difference?

Here I am adding the code snippet also if it helps in solving this issue.

<ps:MassApprovalAjaxPanel runat="server" ID="m_UIRadAjaxPanel" LoadingPanelID="m_UIAsynBindLoadPanelInMasterPage">
    <ps:MassApprovalRadGrid
        runat="server"
        ID="m_UIListingGrid"
        SkinID="Grid_MassApproval"
        OnNeedDataSource="ListingGrid_NeedDataSource"
        OnItemDataBound="ListingGrid_ItemDataBound"
        AllowFilteringByColumn="true"
        EnableViewState="true">
        <MasterTableView
            DataKeyNames="CardID, WeekEnding, ClientPONumber"
            ShowFooter="true">
            <Columns>
                <ps:NumericTextBoxTemplateColumn
                    UniqueName="CardID"
                    Width="70"
                    RelativeWidthRatio="90">
                    <ItemTemplate>
                        <asp:Label
                            runat="server"
                            Text='<%# string.Format("{0}/{1}", Eval(Constants.CARD_ID), Eval(Constants.VERSION)) %>' />
                    </ItemTemplate>            
                </ps:NumericTextBoxTemplateColumn>
                 
                <ps:TextBoxBoundColumn
                    UniqueName="ClientPONumber"
                    DataField="ClientPONumber"
                    Width="60"
                    RelativeWidthRatio="80" />
                <telerik:GridClientSelectColumn UniqueName="SelectAll" HeaderText="All" />
            </Columns>
        </MasterTableView>
    </ps:MassApprovalRadGrid>
</ps:MassApprovalAjaxPanel>

and the server code goes like this

protected void ListingGrid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
    m_UIListingGrid.DataSource = RadGridUtilUI.MassApprovalResultsGet();
}
 
protected void ListingGrid_ItemDataBound(object sender, GridItemEventArgs e)
{
    GridDataItem gridDataItem = e.Item as GridDataItem;
    if (gridDataItem != null)
    {
        AddClientScripts(gridDataItem);
    }
}

and the skin id

<custom:MassApprovalRadGrid runat="server"
    SkinID="Grid_MassApproval"
    Skin="Plain"
    Width="995"
    AutoGenerateColumns="false"
    AllowSorting="false"
    AllowPaging="false"
    AllowMultiRowSelection="true"
    EnableAJAX="true"
    EnableEmbeddedSkins="false"
    EnableEmbeddedBaseStylesheet="false">
    <FooterStyle BackColor="#dddddd" BorderWidth="0" BorderStyle="None" />
        <ClientSettings>
            <Selecting AllowRowSelect="true" />
        </ClientSettings>
</custom:MassApprovalRadGrid>

Thanks,
Preetham.
0
Eyup
Telerik team
answered on 29 Aug 2012, 07:25 AM
Hello Preetham,

Please note that custom created controls are not supported even if they are inherited directly from RadControls. Therefore, you will need to review your specific implementation logic since the case is out-of-scope for our support team.

We will be glad if we could help on issues related with the use of RadControls in a direct manner.

All the best,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Preetham
Top achievements
Rank 2
answered on 29 Aug 2012, 02:43 PM
Hi Eyup,

Thanks for the reply, anyhow I could find the solution for the issue and we have fixed it..at first we changed all of the columns to TemplateColumns instead of BoundColumns but the issue was we were not clearing the filtervalue in the mastertable

Here is the fix,
protected void ListingGrid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
    m_UIListingGrid.MasterTableView.FilterExpression = string.Empty;
    m_UIListingGrid.DataSource = RadGridUtilUI.MassApprovalResultsGet();
}

adding this line 
m_UIListingGrid.MasterTableView.FilterExpression = string.Empty;
in the NeedDataSource did the trick

Mark this as an answer.

Thanks,
Preetham.
Tags
Grid
Asked by
Preetham
Top achievements
Rank 2
Answers by
Eyup
Telerik team
Preetham
Top achievements
Rank 2
Share this question
or