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

Rad Filter Default on Page Load

6 Answers 156 Views
Filter
This is a migrated thread and some comments may be shown as answers.
rik butcher
Top achievements
Rank 1
rik butcher asked on 14 Mar 2012, 02:51 PM
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>

6 Answers, 1 is accepted

Sort by
0
Antonio Stoilkov
Telerik team
answered on 19 Mar 2012, 10:23 AM
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.
0
rik butcher
Top achievements
Rank 1
answered on 20 Mar 2012, 04:32 PM
i just want a "click" event to be triggered by "page Load" - not build the whole filter all over again.
0
Antonio Stoilkov
Telerik team
answered on 23 Mar 2012, 08:56 AM
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.
0
rik butcher
Top achievements
Rank 1
answered on 03 May 2012, 03:18 PM
so, i assume theres NO WAY to do this in the code behind, correct?
0
rik butcher
Top achievements
Rank 1
answered on 04 May 2012, 01:04 PM
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
0
rik butcher
Top achievements
Rank 1
answered on 04 May 2012, 04:22 PM
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);

Tags
Filter
Asked by
rik butcher
Top achievements
Rank 1
Answers by
Antonio Stoilkov
Telerik team
rik butcher
Top achievements
Rank 1
Share this question
or