how to get asp:panel control which is placed inside Scheduler's Advance Form control

2 posts, 0 answers
  1. Richard
    Richard  avatar
    3 posts
    Member since:
    Jun 2011

    Posted 29 Nov 2011 Link to this post

    Hi,
    I have placed a radcombobox and asp:panel id="Panel1" inside Advance Form control (AdvanceForm.ascx)
    I Intend to make panel1 visible or Invisible based on the radcombobox selection using OnClientSelectedIndexChanged event of radcombobox.

    Using telerik find method in javascript, I can easily get the telerik control but cant get asp.net controls.
    For Example
    function StartDateSelected_AdvancedInsert(sender, args) {
            var $ = $telerik.$;
            var endDatejQueryObject = $("[id$='AdvancedInsertForm_EndDate']");
            var endDatePicker = $find(endDatejQueryObject.attr("id"));
    }
    Its all good for RadDatePicker but when i change it to 
    [id$='AdvancedInsertForm_AdvanceControlPanel']it doesn't return any panel control.
    
    
    
  2. Ivana
    Admin
    Ivana avatar
    657 posts

    Posted 30 Nov 2011 Link to this post

    Hi Richard ,

    To  hide / show an asp.net control you could use the code below:
    function selectedIndexChanged(sender, args)
    {
        var $ = $telerik.$;
        var panel = $("[id$='Panel1']");
        if (args.get_item().get_text() == "hidden")
        {
            panel.css("visibility", "hidden");
        } else
        {
            panel.css("visibility", "visible");
        }
    }
    <telerik:RadComboBox runat="server" ID="RadComboBox1" OnClientSelectedIndexChanged="selectedIndexChanged">
        <Items>
            <telerik:RadComboBoxItem runat="server" Text="hidden" />
            <telerik:RadComboBoxItem runat="server" Text="visible"/>
        </Items>
    </telerik:RadComboBox>
    <asp:Panel runat="server" ID="Panel1" style="visibility: hidden;">
        <asp:TextBox runat="server" />
    </asp:Panel>
    The panel defined on the page hides/shows depending on the RadComboBox's selected text.

    The $find method does not work with asp.net controls, because it tries to find the client object for a control which ID is set as an argument, and for the asp.net controls such an object does not exist.

    All the best,
    Ivana
    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
Back to Top