Rad grid Filter is not working in Sharepoint webpart

7 posts, 0 answers
  1. Santhanam
    Santhanam avatar
    6 posts
    Member since:
    Sep 2008

    Posted 19 Sep 2008 Link to this post

    Hi,
        I am using Rad Grid in my Sharepoint webpart. I enabled Rad Grid filter by setting the AllowFilteringByColumn ="true". All the column has text box control for filtering the result. but filter is not working. i.e., it is not filtering based on the filter condition. It is always showing same results. This is my code

    <

    telerik:RadGrid AllowFilteringByColumn="true" PagerStyle-Mode="NextPrevAndNumeric" PagerStyle-NextPageImageUrl="ewr112.gif" PagerStyle-PrevPageImageUrl="ewr115.gif" PagerStyle-NextPageText="Next" PagerStyle-PrevPageText="Prev" PagerStyle-PagerTextFormat="Pages: {4} &#160;|&#160; Displaying Page {0} of {1}, Items {2} to {3} of {5}." id="rgDetails" EnableAJAX="True" Width="1000px" AllowSorting="True" AutoGenerateColumns="false" AllowPaging="True" runat="server" Skin="Office2007" GridLines="None" OnNeedDataSource="rgDetails_NeedDataSource">

    <PagerStyle Position="TopAndBottom" PagerTextFormat="Pages: {4} &#160;|&#160; Displaying Page {0} of {1}, Items {2} to {3} of {5}." />

    <ClientSettings>

    <Resizing AllowColumnResize="True" EnableRealTimeResize="True" ResizeGridOnColumnResize="True">

    </Resizing>

    <Scrolling AllowScroll="True" UseStaticHeaders="true" SaveScrollPosition="True" FrozenColumnsCount="1" ></Scrolling>

    </ClientSettings>

    <MasterTableView>

    </MasterTableView>

    </telerik:RadGrid>

     Can you tell what is wrong in this?

    Thanks and Regards,
    S.Santanamahalingam

  2. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 19 Sep 2008 Link to this post

    Hi Santhanam,

    Does the filtering feature of the control works as expected outside of the Sharepoint environment (placing the grid in a test page of a regular ASP.NET site)? Furthermore, you can debug your code and check the filter expression applied for the grid when filtering process occurs. This can help us determine the reason for the issue you are facing and address it accordingly.

    Best regards,
    Stephen
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.

  3. Santhanam
    Santhanam avatar
    6 posts
    Member since:
    Sep 2008

    Posted 22 Sep 2008 Link to this post

    Hi Stephen,
        Thanks for your immediate reply. I test the same thing in Test website page. In this also i had the same problem. Actually following filter is working (IsEmpty, NotIsEmpty, IsNull, NotIsNull and NoFilter). Except the above filter nothing is working. I had the grid column with data type is string. I need to test the Contains, EqualTo filter condition. But it is not working.
        Can you give some idea to troubleshoot this issue.

    Thanks and Regards,
    S.Santhanamahalingam
  4. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 22 Sep 2008 Link to this post

    Hi Santhanam,

    I assume that you inspected the filter expression of the grid when filtering operation occurs (as implied in my previous reply) - can you please specify what your findings are? They can shed some additional light on the matter and help us determine the cause of the issue to eliminate it.

    On a side note, your account details indicate that you are using a trial version of our control. Hence you may consider migrating to the ASP.NET AJAX counterpart of RadGrid as it exposes numerous new features/enhancements that you may find helpful.

    Review the online resources linked below for more details:

    http://www.telerik.com/help/aspnet-ajax/grdwhatsnew.html
    http://www.telerik.com/help/aspnet-ajax/grdmigrationtoprometheus.html

    http://www.telerik.com/products/aspnet-ajax/top-performance.aspx
    http://www.telerik.com/products/aspnet-ajax/faq.aspx

    Best regards,

    Stephen
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. Santhanam
    Santhanam avatar
    6 posts
    Member since:
    Sep 2008

    Posted 22 Sep 2008 Link to this post

    Hi stephen,

        I had following code in my code behind file,

     

    protected void Page_Load(object sender, EventArgs e)

    {

    RadGrid1.Rebind();

    }

    private DataTable LoadDetails()

    {

    DataTable dtDetails = new DataTable();

    dtDetails.Columns.Add(

    "Project");

    dtDetails.Columns.Add(

    "Project_Desc");

    dtDetails.Columns.Add(

    "Manager1");

    dtDetails.Columns.Add(

    "StartDate");

    dtDetails.Columns.Add(

    "EndDate");

    dtDetails.Rows.Add(

    new object[] { "00-2005", "This project is created on 2005", "Santhanam", "05-06-1982", "07-11-2008" });

    dtDetails.Rows.Add(

    new object[] { "00-2008", "Newly created project for this year", "Santhanam", "23-11-2008", "23-11-2010" });

    dtDetails.Rows.Add(

    new object[] { "01-2010", "Feature Project", "Vairam", "05-09-2010", "02-01-2011" });

    dtDetails.Rows.Add(

    new object[] { "02-2020", "Second Planed project on 2020", "Vijay", "03-04-2020", "05-11-2020" });

    dtDetails.Rows.Add(

    new object[] { "01-1980", "In 1980's developed product", "Vairam", "01-02-1999", "07-05-2000" });

    dtDetails.Rows.Add(

    new object[] { "10-1988", "This project is created on 1988", "Santhanam", "07-05-1988", "16-03-2000" });

    dtDetails.Rows.Add(

    new object[] { "22-2015", "This project is created on 2015", "Vijay", "25-04-2015", "09-10-2015" });

    dtDetails.Rows.Add(

    new object[] { "11-2008", "", "Vairam", "15-06-2008", "19-09-2008" });

    dtDetails.Rows.Add(

    new object[] { "CO-2005", "This project is created on 2005", "Vijay", "30-07-2005", "20-08-2008" });

    dtDetails.Rows.Add(

    new object[] { "FC-6204", "This project is created on 6204", "Santhanam", "05-06-1982", "16-05-2004" });

    dtDetails.AcceptChanges();

    return dtDetails;

    }

    protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)

    {

    RadGrid1.DataSource = LoadDetails();

    }


    In the design page, I had following code

    <form id="form1" runat="server">

     

    <asp:ScriptManager ID="ScriptManager1" runat="server" />

     

    <div>

     

    <telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True" OnNeedDataSource="RadGrid1_NeedDataSource">

     

    <MasterTableView>

     

    <RowIndicatorColumn Visible="False">

     

    <HeaderStyle Width="20px" />

     

    </RowIndicatorColumn>

     

    <ExpandCollapseColumn Resizable="False" Visible="False" CurrentFilterFunction="Contains">

     

    <HeaderStyle Width="20px" />

     

    </ExpandCollapseColumn>

     

    <EditFormSettings>

     

    <PopUpSettings ScrollBars="None" />

     

    </EditFormSettings>

     

    </MasterTableView>

     

    </telerik:RadGrid>

     

    </div>

     

    </form>

    I tried to filter the record in the following scenario,

    S.No          FilterText                Filter Condition        FilterColumn
    1.                00                            StartsWith                Project
    2.                2005                        Contains                   Project
    3.                Santhanam            EqualTo                    Manager1

    Can you give some solution to fix the issue,

    Thanks and Regards,
    S.Santhanamahalingam

  6. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 22 Sep 2008 Link to this post

    Hi Santhanam,

    You should not call Rebind() for every Page_Load!

    Sincerely yours,
    Vlad
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  7. Santhanam
    Santhanam avatar
    6 posts
    Member since:
    Sep 2008

    Posted 22 Sep 2008 Link to this post

    Hi Stephen and Vlad,
        Great Thanks to Stephen and Vlad. Now it is working. 

    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack)
            RadGrid1.Rebind();
    }

    Can you Give some sample code for between operator.

    Thanks and regards,
    S.Santhanamahalingam.

Back to Top