How could i Rad Filter id in Server Side

Thread is closed for posting
5 posts, 1 answers
  1. New
    New  avatar
    25 posts
    Member since:
    Jul 2012

    Posted 27 Jun 2012 Link to this post

    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.
  2. Tsvetina
    Admin
    Tsvetina avatar
    1873 posts

    Posted 02 Jul 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. New
    New  avatar
    25 posts
    Member since:
    Jul 2012

    Posted 02 Jul 2012 Link to this post

    Thanks for ur reply Tsvetina,

    That i want to check in pre_render
    It's Urgent
    Thanks Advance ,
    New Gene .
  5. Answer
    Tsvetina
    Admin
    Tsvetina avatar
    1873 posts

    Posted 02 Jul 2012 Link to this post

    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.
  6. New
    New  avatar
    25 posts
    Member since:
    Jul 2012

    Posted 03 Jul 2012 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017