Rad Filter Default on Page Load

7 posts, 0 answers
  1. rik butcher
    rik butcher avatar
    106 posts
    Member since:
    Jul 2009

    Posted 14 Mar 2012 Link to this post

    is there a way in the code behind on page load to automatically make the rad filter default as if a user has clicked
    the "And" - see screenshot
    . it would be great if i could default this to behave as if the user had clicked the "Add Expression" button.
    any help is appreciated.
    thanks again
    rik


     <telerik:RadFilter ID="WorkOrdersRadFilter" runat="server" Skin="WebBlue" ShowApplyButton="true"
                            OnApplyExpressions="WorkOrdersRadFilter_Apply" ApplyButtonText="Filter Work Orders"
                            OnPreRender="WorkOrdersRadFilter_PreRender" OnFieldEditorCreating="RadFilter_FieldEditorCreating"   OnItemCommand="WorkOrdersRadFilter_ItemCommand">
                           
                            <FieldEditors>
                                <telerik:RadFilterTextFieldEditor FieldName="WORKORDERNUMBER" DisplayName="Work Order#"
                                    DataType="System.String" />  </FieldEditors>
                                      
    </telerik:RadFilter>
  2. Antonio Stoilkov
    Admin
    Antonio Stoilkov avatar
    530 posts

    Posted 19 Mar 2012 Link to this post

    Hello Rik,

    You could achieve your scenario by following the demo below which shows the same functionality implemented. The idea is to add expression to the RadFilter RootGroup Expressions collection by calling the AddExpression method.

    Greetings,
    Antonio Stoilkov
    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. rik butcher
    rik butcher avatar
    106 posts
    Member since:
    Jul 2009

    Posted 20 Mar 2012 Link to this post

    i just want a "click" event to be triggered by "page Load" - not build the whole filter all over again.
  5. Antonio Stoilkov
    Admin
    Antonio Stoilkov avatar
    530 posts

    Posted 23 Mar 2012 Link to this post

    Hi Rik,

    If you want to focus the input element from the filter you could use the code below to achieve your scenario.
    <telerik:RadScriptBlock runat="server">
        <script>
            function pageLoad()
            {
                setTimeout(function()
                {
                    var input = document.getElementById("<%= WorkOrdersRadFilter.ClientID %>").getElementsByTagName("input")[0];
                    if (input.className == "rfText")
                    {
                        input.focus();
                    }
                }, 100);
            }
        </script>
    </telerik:RadScriptBlock>



    Kind regards,
    Antonio Stoilkov
    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.
  6. rik butcher
    rik butcher avatar
    106 posts
    Member since:
    Jul 2009

    Posted 03 May 2012 Link to this post

    so, i assume theres NO WAY to do this in the code behind, correct?
  7. rik butcher
    rik butcher avatar
    106 posts
    Member since:
    Jul 2009

    Posted 04 May 2012 Link to this post

    i guess i'm asking for a lot, but there is an event that causes a postback when the user clicks the "add expression" section of the rad filter.
    i'm simply trying to do that very same thing.
    we have mutiview screens w/ separate rad filters on them and it would be handy when a used clicked one of those tabs if that particular filter would also mimick in the code behind the same event that happens when they click the "add expression".
    if no one can do this, just let me know its a limitation of the control. but, i can't help but be curious at this point. since our whole application is nothing but telerik controls.
    thanks
    rik
  8. rik butcher
    rik butcher avatar
    106 posts
    Member since:
    Jul 2009

    Posted 04 May 2012 Link to this post

    Well I figured this out myself. this is exactly what i was asking for and looking for to happen in the code behind.
    Not a Link to a Tutorial - i already know where those are.

     

     

    RadFilterStartsWithFilterExpression expr1 = new RadFilterStartsWithFilterExpression("WORKORDERNUMBER");

     

    expr1.Value =

     

    "";

     

    WorkOrdersRadFilter.RootGroup.AddExpression(expr1);

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