NullReferenceException using RadFilter in Page_Load

3 posts, 0 answers
  1. Kurtis
    Kurtis avatar
    2 posts
    Member since:
    Apr 2016

    Posted 17 Jun Link to this post

    Hi, I have a RadFilter that I am trying to add an expression to on the form load. The idea is that when someone clicks a hyperlink on a different page, they are redirected to a different page and the radfilter is set up for them with the data they clicked (in this specific case, it would Select Amends and put in the appropriate value.

    I just want to mention that this code works exactly how I need it to when It is inside of a button click event on the page that gets redirected to.

    The following is called in my page_load:

            pnlSearch.Visible = False
            pnlAdvanced.Visible = True

            Dim amendsByExpression = New RadFilterContainsFilterExpression("Amends")
            amendsByExpression.Value = Session("Search_Text")
            rfAdvancedSearch.RootGroup.AddExpression(amendsByExpression)
            rfAdvancedSearch.FireApplyCommand()

     

    Why does the code above work when its encapsulated inside of a linkbutton click event, but not in the page load? How can I make it work in the Page Load?

  2. Kurtis
    Kurtis avatar
    2 posts
    Member since:
    Apr 2016

    Posted 20 Jun in reply to Kurtis Link to this post

    Just for more information, my control on the aspx page looks like this:

    <telerik:RadFilter ID="rfAdvancedSearch" runat="server" DataSourceControlID="dsBylaw" FilterContainerID="rgBylaw" SharedCalendarMinDate="1870-01-01" 
                Visible="True" DefaultFieldEditorFieldName="Title" 
                Localization-FilterFunctionIsNull="" 
                Localization-FilterFunctionNotIsNull="" 
                Localization-FilterFunctionIsEmpty="" 
                Localization-FilterFunctionNotIsEmpty=""
                Localization-FilterFunctionLessThanOrEqualTo="Less Than Or Equal To" 
                Localization-FilterFunctionGreaterThanOrEqualTo="Greater Than Or Equal To" 
                Localization-FilterFunctionGreaterThan="Greater Than" 
                Localization-FilterFunctionEqualTo="Equal To" 
                Localization-FilterFunctionEndsWith="" 
                Localization-FilterFunctionLessThan="Less Than" 
                Localization-FilterFunctionStartsWith=""
                Localization-FilterFunctionDoesNotContain="" 
                Localization-FilterFunctionNotBetween="" 
                Localization-FilterFunctionNotEqualTo="">
            </telerik:RadFilter>

     

     

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 22 Jun Link to this post

    Hi Kurtis,

    You can check the following live sample:
    http://demos.telerik.com/aspnet-ajax/filter/examples/field-editors/defaultcs.aspx

    Alternatively, you can try to do that on a different stage of the page life cycle, for example PreRender.

    Regards,
    Eyup
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top