This is a migrated thread and some comments may be shown as answers.
Hiding Panels in a Custom Advanced Form
5 Answers 42 Views
This is a migrated thread and some comments may be shown as answers.
CodeR
Top achievements
Rank 2
CodeR asked on 25 Nov 2009, 04:54 AM
Hello,

I'd like to be able to hide some of the panels or elements within my Advanced Form based on the users access levels. I've found an old post with something similar at the very bottom here however the control is now a couple of releases older since then. In following the example I still get errors from the AdvancedForm.js with missing StartDate and EndDate controls.

Are there any examples that I've missed or can you provide me with an example of how I could achieve this?

Cheers,
Damien

5 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 25 Nov 2009, 02:59 PM
Hello Damien,

One important difference regarding the advanced form when compared to that of older versions of RadScheduler is that now it uses Telerik controls such as RadTextBox, RadComboBox, etc. instead of their standard asp counterparts. I suggest you review the following up-to-date kb article:

http://www.telerik.com/support/kb/aspnet-ajax/scheduler/how-to-access-controls-in-the-advanced-form.aspx


Regards
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
CodeR
Top achievements
Rank 2
answered on 26 Nov 2009, 04:06 AM

Hello Peter,

The example in the knowledge base doesn't mention how to change the visibility of items just how to change the labels on them. I particularly want to know how to hide the start and end date controls.

The example that I was following mentioned using a CSS style to set the visibility to hidden as a way of hiding yet still rendering the control enabling the Javascript in the AdvancedForm.js to work correctly. Given that the Advanced Form is now using telerik controls do I need to do something different to achieve the same result or should setting the visibility to hidden still work?

The example I was following;

protected void RadScheduler1_FormCreated(object sender, Telerik.Web.UI.SchedulerFormCreatedEventArgs e)     
    {     
        if ((e.Container.Mode == SchedulerFormMode.AdvancedEdit) || (e.Container.Mode == SchedulerFormMode.AdvancedInsert))     
        {     
            CheckBox allDayCheckBox = (CheckBox)e.Container.FindControl("AllDayEvent");     
            allDayCheckBox.CssClass = "Hide";     
    
            TextBox subjectTextBox = (TextBox)e.Container.FindControl("Subject");     
            subjectTextBox.Height = Unit.Pixel(0);     
    
         }     
    }    
 

<style type="text/css">     
    .Hide, .textareaWrapper     
    {     
        visibility:hidden !important;     
    }        
</style> 


Cheers,
Damien

0
Peter
Telerik team
answered on 26 Nov 2009, 12:28 PM
Hello Damien,

If you need to hide the date and time pickers in the advanced form, you can simply use the following css:
.rsTimePickers
    {
        visibility: hidden !important;    
    }

Let us know if you have further questions or concerns.


Kind regards,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
CodeR
Top achievements
Rank 2
answered on 27 Nov 2009, 12:05 AM
I've discovered that applying the visibility = hidden to the BasicControlsPanel to take out the subject and datetime pickers causes errors in the AdvancedForm,js however wrapping that panel in a div and changing the class server side on the div works a treat.

Is there any particular reason to use the Visibility tag rather than Display? Display works a little neater as it collapses the area rather than leaving a large white space.

Cheers,
Damien
0
Peter
Telerik team
answered on 27 Nov 2009, 09:42 AM
Hi Damien,

The problem with hiding the Subject RadTextBox control in the advanced form is that RadScheduler sets focus to it. So if it is not rendered as in the case when you set display: none to it, an error will occur. A workaround for hiding the subject field can be the following:

<style type="text/css"
     span#RadScheduler1_Form_Subject_wrapper 
     
         width: 0px
         height: 0px
         overflow: hidden
         display: block
     
   </style>

 
protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
{
    if (e.Container.Mode == SchedulerFormMode.AdvancedEdit || e.Container.Mode == SchedulerFormMode.AdvancedInsert) {
        RadTextBox subject = e.Container.FindControl("Subject") as RadTextBox;
        subject.Label = "";
  
        RequiredFieldValidator subjectValidator = e.Container.FindControl("SubjectValidator") as RequiredFieldValidator;
        subjectValidator.Visible = false;
    }
}

If you specify what exactly you need to accomplish, we might be able to offer a better solution.


All the best,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Asked by
CodeR
Top achievements
Rank 2
Answers by
Peter
Telerik team
CodeR
Top achievements
Rank 2
Share this question
or