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

Hide elements based on scheduler state

4 Answers 64 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 13 May 2009, 07:25 PM
I have a few combo boxes above my calendar that allow users to select resources.  My question is how can I hide those combo boxes when the user goes to the advanced edit page? 

4 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 18 May 2009, 08:45 AM
Hello Matt,

Here is how you can achieve that:

1. Subscribe the on OnClientFormCreated event: OnClientFormCreated="onClientFormCreated"
2. Add the following javascript code to your page:

<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server"
<script type="text/javascript"
function onClientFormCreated(sender, e) 
    shouldBeEnabled = false
 
var shouldBeEnabled = true
 
function pageLoad() 
    toggleCombo(shouldBeEnabled); 
 
function toggleCombo(state) 
    var combo = $find("<%= RadComboBox1.ClientID %>"); 
    switch (state) 
    { 
        case true: combo.enable();break
        case false: combo.disable(); shouldBeEnabled = truebreak
    } 
</script>         
</telerik:RadScriptBlock>  

I hope this helps.

Regards,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Matt
Top achievements
Rank 1
answered on 18 May 2009, 06:12 PM
Wow, that's slick.  That disables the box.  What javascript would I use to hide the combobox?
0
Accepted
Veselin Vasilev
Telerik team
answered on 19 May 2009, 12:15 PM
Hi Matt,

Ah, yes, here is the modified toggleCombo function:

function toggleCombo(state) 
    var combo = $find("<%= RadComboBox1.ClientID %>"); 
    switch (state) 
    { 
        case truecombo.get_element().style.visibility = ""break
        case falsecombo.get_element().style.visibility = "hidden"; shouldBeEnabled = truebreak
    } 


Best wishes,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Matt
Top achievements
Rank 1
answered on 19 May 2009, 03:41 PM
Thanks for the code!  Took what you gave me, modified it a little bit and it works great.  Here's my modified code just in case anyone can use it:

<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">  
<script type="text/javascript"
    //<![CDATA[
function onClientFormCreated(sender, e) 
    shouldBeEnabled = false
}

var shouldBeEnabled = true
 
function pageLoad() { 
    toggleCombo(shouldBeEnabled); 
 
function toggleCombo(state) { 
    var combo = document.getElementById('tblComboBoxes'
    switch (state) { 
        case true: combo.style.visibility = ""; combo.style.display = ""break
        case false: combo.style.visibility = "hidden"; combo.style.display = "none"; shouldBeEnabled = truebreak
    } 
}  
 
    //]]>  
</script>         
</telerik:RadScriptBlock>  

I have a table with id="tblComboBoxes' which include multiple label and comboboxes.  This hides the entire table when the edit form is called.
Tags
Scheduler
Asked by
Matt
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Matt
Top achievements
Rank 1
Share this question
or