Question about filtering with custom paging

7 posts, 0 answers
  1. Condorito
    Condorito avatar
    38 posts
    Member since:
    Mar 2009

    Posted 27 Mar 2009 Link to this post

    Hi,

    I'm new to the Telerik controls so sorry if there's a simple answer to these questions.  I have a Grid that I populate using a stored procedure that has custom paging and filtering.  I don't want to display the filter icon so I looked at the example below:

    http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/filtering/defaultcs.aspx

    And I realized that the ShipName column was exactly what I needed.  It works, except that locally, when I type something into the filter textbox and press Enter, nothing happens.  I need to click the Grid itself in order for it to apply the filtering.  The online demo works great.   I copied the exact same code from the demo into my PC, just used a different datasource and the Enter key won't work anymore.  Am I missing something?   This is how I'm declaring my column:

    <

     

    telerik:GridBoundColumn DataField="EmailAddress" AllowFiltering="true" HeaderText="Email Address" FilterControlWidth="150px"

     

     

    AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" UniqueName="EmailAddress"/>

     


    Also, how do I retrieve the name of the column and the value users typed into the textbox when clicking enter when filtering?  The closest I saw was the FilterExpression property of the MasterTableView, but it doesn't give me the column and value entered as separate values, so I'd have to parse through it to figure it out, unless there is a better way.

    Thank you in advance!
  2. Todd Anglin
    Todd Anglin avatar
    2040 posts
    Member since:
    Aug 2005

    Posted 27 Mar 2009 Link to this post

    Hello Juan-

    Your code for the EmailAddress column looks exactly correct. You should be able to trigger filtering with that setup. Just make sure that you've enable filtering at the Grid level (AllowFilteringByColumn="true") and you should be ready to go. If you still have trouble, please let us know which browser you're using, which version of the RadControls, and that should help us further understand your scenario.

    As for accessing the value of the filter and the column name from code, check out this article in the help docs and see if it helps answer your question:


    Hope that helps!
    -Todd

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Condorito
    Condorito avatar
    38 posts
    Member since:
    Mar 2009

    Posted 27 Mar 2009 Link to this post

    Hi Todd,

    Thank you!  That's exactly what I was looking for. 

    As far as the problem with the Enter key, I have AllowFilteringByColumn="true" under both the Grid Level and I even added to the MasterTableView just in case, and the problem still happens. 

    I'm using IE8, along with RadControls for ASPNET AJAX Q1 2009 under Visual Studio 2008 .NET Framework 3.5 SP 1

    I had actually used an earlier version of the RadControls and I got the same behavior, so I upgraded thinking it would solve the problem, but it didn't.  What is strange is that when I try the demo I mentioned earlier online using the same browser, the grid behaves as expected (I enter a value, hit enter and it refreshes with the filtered data).

    I must be overlooking something, this is the entire grid I modified from the demo, I just added one column to it and it didn't work, I hit enter and nothing happens, but as soon as I click anywhere else in the grid I get my filtered data:

    <

     

    telerik:RadGrid AutoGenerateColumns="false" ID="RadGrid1" DataSourceID="SqlDataSource1"
    Width="760px" AllowFilteringByColumn="True" AllowSorting="True"
    PageSize="15" ShowStatusBar="true" ShowFooter="True" AllowPaging="True" runat="server"
    GridLines="None" EnableLinqExpressions="false">
    <PagerStyle Mode="NextPrevAndNumeric" />
    <GroupingSettings CaseSensitive="false" />
    <MasterTableView AutoGenerateColumns="false" EditMode="InPlace" AllowFilteringByColumn="True" ShowFooter="True"
    TableLayout="Auto">

     

     

    <Columns>
    <telerik:GridBoundColumn FilterControlWidth="105px" DataField="EmailAddress" HeaderText="EmailAddress" SortExpression="EmailAddress" UniqueName="EmailAddress" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false">
    </telerik:GridBoundColumn>
    </Columns>
    </MasterTableView>
    <ClientSettings>
    <Scrolling AllowScroll="false" />
    </ClientSettings>
    </telerik:RadGrid>

     

  5. Todd Anglin
    Todd Anglin avatar
    2040 posts
    Member since:
    Aug 2005

    Posted 27 Mar 2009 Link to this post

    Your code looks right! Unfortunately, that makes things harder to debug. Do you have any other custom JavaScript on the page that may be interferring with this functionality? At this point, in my own projects, I usually try to a create a "dead simple" page and start building-up with no extra "distracting code" and see at what point the functionality stops working. If it doesn't work even on the most simple page, then there is usually an environment problem.

    I'd suggest you try to isolate your Grid just to see if you can get the FilterOnEnter working. If you can, then start adding the other code of your site and you should be able to discover what's at play here. I know it's not a silver bullet, but I think that's the point you're at. As far as your Telerik code goes, it looks good and it should work.

    Hope that helps in some way-
    Todd
  6. Condorito
    Condorito avatar
    38 posts
    Member since:
    Mar 2009

    Posted 27 Mar 2009 Link to this post

    Hi Todd,

    Thank your for suggestion.  It still does the same behavior, I don't know what to do anymore.  I copied the code and pasted it into another project in a different PC, and it works the way it should!  I'm not going to worry about it for now, thank you for your help!

    Juan.
  7. Condorito
    Condorito avatar
    38 posts
    Member since:
    Mar 2009

    Posted 01 Apr 2009 Link to this post

    I figured out what the problem was with the enter key not working,  it looks like it was the skin I was using for the grid for some reason.  I was using the "Sunset" skin when I had this problem, but when I switched it to "Office2007", everything started to work the way it should.
  8. Todd Anglin
    Todd Anglin avatar
    2040 posts
    Member since:
    Aug 2005

    Posted 01 Apr 2009 Link to this post

    That's definitely strange. If you look at the demo in the Telerik Quick Start Framework (i.e. the online demos), you should see that everyhting works with both the Office and Sunset skins. There must be something either A) custom, or B) corrupt about the version of the Sunset skin you're using. Have you tried running the QSF demos locally on your machine to see if you can reproduce the problem there?

    Happy to hear you've got your solution working, at least. Hopefully you can get it working with the skin you want, too.

    -Todd
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017