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

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

1 Answer 57 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 29 Nov 2011, 01:47 PM
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.



1 Answer, 1 is accepted

Sort by
0
Ivana
Telerik team
answered on 30 Nov 2011, 04:55 PM
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
Tags
Scheduler
Asked by
Richard
Top achievements
Rank 1
Answers by
Ivana
Telerik team
Share this question
or