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

RadFilter Menu Items.

1 Answer 58 Views
UI for ASP.NET AJAX in ASP.NET MVC
This is a migrated thread and some comments may be shown as answers.
Gowtham
Top achievements
Rank 2
Gowtham asked on 05 Aug 2013, 12:58 PM

Hi,

My requirement is to disable the menu items in the RadFilter. Let me explain it, I have a RadFilter linked dynamically to a RadGrid. On load  he RadFilter opens with a predefined expression. Now i need to change the Data Field and filter function drop down boxes such that , only the first value is set and user will not be allowed to access the drop down box.

I have attached the screenshot, in that i need to set the value as TASK and CONTAINS then the drop down should be diabled

1 Answer, 1 is accepted

Sort by
0
Antonio Stoilkov
Telerik team
answered on 08 Aug 2013, 07:24 AM
Hello Gowtham,

In order to achieve your scenario you could subscribe to RadFilter OnExpressionItemCreated event, access the choosers and set their Enable property to false as shown below.
protected void RadFilter1_ExpressionItemCreated(object sender, Telerik.Web.UI.RadFilterExpressionItemCreatedEventArgs e)
{
    RadFilterSingleExpressionItem singleExpressionItem = e.Item as RadFilterSingleExpressionItem;
    if (singleExpressionItem != null)
    {
        singleExpressionItem.FieldNameChooserLink.Enabled = false;
        singleExpressionItem.FilterFunctionChooserLink.Enabled = false;
    }
}

Additionally, you could set default FilterFunction and FieldName by using the new RadFilter.DefaultFieldEditorFieldName and each field editor DefaultFilterFunction properties.
<telerik:RadFilter ID="RadFilter1" runat="server" OnFieldEditorCreating="RadFilter1_FieldEditorCreating" OnExpressionItemCreated="RadFilter1_ExpressionItemCreated"
    DefaultFieldEditorFieldName="Task">
    <FieldEditors>
        <telerik:RadFilterTextFieldEditor FieldName="Task" DefaultFilterFunction="Contains" />
    </FieldEditors>
</telerik:RadFilter>


Regards,
Antonio Stoilkov
Telerik
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 the blog feed now.
Tags
UI for ASP.NET AJAX in ASP.NET MVC
Asked by
Gowtham
Top achievements
Rank 2
Answers by
Antonio Stoilkov
Telerik team
Share this question
or