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

How could i Rad Filter id in Server Side

4 Answers 73 Views
UI for ASP.NET AJAX in ASP.NET MVC
This is a migrated thread and some comments may be shown as answers.
New
Top achievements
Rank 1
New asked on 27 Jun 2012, 10:03 AM
Hi..
How could i Rad Filter id in Server Side.
I have Two RadFilter control used for my application.
How to find Which RadFilter id click AddExpression and RemoveItem.
I have attached my screen shot also...

Thanks
Newgene.

4 Answers, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 02 Jul 2012, 08:18 AM
Hello Newgene,

You can attach each RadFilter's ItemCommand event separately and have an if-statement which checks the command name. There are command names for adding and removing expressions:

RadFilter.AddExpressionCommandName
RadFilter.RemoveExpressionCommandName
RadFilter.RemoveGroupCommandName

This way you can execute control-specific logic on the server-side.

Greetings,
Tsvetina
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
New
Top achievements
Rank 1
answered on 02 Jul 2012, 08:50 AM
Thanks for ur reply Tsvetina,

That i want to check in pre_render
It's Urgent
Thanks Advance ,
New Gene .
0
Accepted
Tsvetina
Telerik team
answered on 02 Jul 2012, 12:36 PM
Hello,

You cannot check this directly in PreRender, but you could use a global variable, assign its value in ItemCommand and check it on PreRender:
string filterId = "";
protected void RadFilter1_ItemCommand(object sender, RadFilterCommandEventArgs e)
{
    if (e.CommandName == RadFilter.AddExpressionCommandName || e.CommandName == RadFilter.RemoveExpressionCommandName)
    {
        filterId = (sender as RadFilter).ID;
    }
}
 
protected void RadFilter2_ItemCommand(object sender, RadFilterCommandEventArgs e)
{
    if (e.CommandName == RadFilter.AddExpressionCommandName || e.CommandName == RadFilter.RemoveExpressionCommandName)
    {
        filterId = (sender as RadFilter).ID;
    }
}
 
protected void Page_PreRender(object sender, EventArgs e)
{
    switch (filterId)
    {
        case "RadFilter1": //.......
            break;
        case "RadFilter2": //......
            break;
        default: //......
            break;
    }
}


All the best,
Tsvetina
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
New
Top achievements
Rank 1
answered on 03 Jul 2012, 09:59 AM
Thanks For Ur Help Tsvetina


I'm Dynamically creating Checkbox when i choose the add expression date field, at the time i create the check box,
First time design ins good ,
next time i click some thing design change like that
See The Image ,

<div style="height: 160px; overflow: auto">
                                               <table>
                                                   <tr>
                                                       <td>
                                                           <telerik:RadFilter runat="server" ID="RadFilter2" FilterContainerID="" ExpressionPreviewPosition="None"
                                                               ClientSettings-ClientEvents-OnFilterCreated="stopClick" ClientSettings-ClientEvents-OnFilterDestroying="stopClick"
                                                               EnableViewState="true" Localization-GroupOperationAnd="<%$ Code:Resources.View.View_MeetAny %>"
                                                               Localization-GroupOperationNotAnd="" Localization-GroupOperationNotOr="" Localization-GroupOperationOr=""
                                                               Localization-FilterFunctionIsNull="Not Specified" OnPreRender="RadFilter2_PreRender"
                                                               ShowApplyButton="false" OnFieldEditorCreating="RadFilter2_FieldEditorCreating"
                                                               OnItemCommand="RadFilter2_ItemCommand" Font-Bold="true">
                                                           </telerik:RadFilter>
                                                       </td>
                                                       <td>
                                                           <br />
                                                           <br />
                                                           <telerik:RadAjaxPanel ID="Panel3" runat="server">
                                                           </telerik:RadAjaxPanel>
                                                       </td>
                                                       <td>
                                                           <br />
                                                           <br />
                                                           <telerik:RadAjaxPanel ID="Panel2" runat="server">
                                                           </telerik:RadAjaxPanel>
                                                       </td>
                                                   </tr>
                                               </table>
                                           </div>

Thanks Advance,
New Gene.
Tags
UI for ASP.NET AJAX in ASP.NET MVC
Asked by
New
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
New
Top achievements
Rank 1
Share this question
or