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

Hide fields "CustomAttributeNames " in AdvancedEditTemplate

22 Answers 530 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
uy_2008
Top achievements
Rank 2
uy_2008 asked on 19 Jan 2008, 02:32 AM
hi support group telerik !
I have a proplem when I want to  hide some fields in Advance Edit (or Insert) Form of  Appointment in Control RadScheduler And I can't do it ! So you can help me to do it !

Example , I have declare  a Scheduler1 :
<telerik:RadScheduler runat="server" ID="RadScheduler1"
                    Skin="Office2007"
                    SelectedDate="2007-12-20" DayStartTime="01:00:00" 
                    OverflowBehavior="Scroll" SelectedView="WeekView" CustomAttributeNames="Value,IDColor"
                    EnableCustomAttributeEditing="true" StartEditingInAdvancedForm ="true"                   
                    DataKeyField="ID" DataSubjectField="Subject" DataStartField="Start" DataEndField="End"
                    DataRecurrenceField="RecurrenceRule" DataRecurrenceParentKeyField="RecurrenceParentID"
                    OnAppointmentUpdate="RadScheduler1_AppointmentUpdate" OnAppointmentDelete="RadScheduler1_AppointmentDelete"
                    OnAppointmentInsert="RadScheduler1_AppointmentInsert" OnNavigationComplete="RadScheduler1_NavigationComplete"
                    Height="530px" Width="546px" AllowDelete="true" AllowEdit="true" AllowInsert="true"
                    OnAppointmentClick="RadScheduler1_AppointmentClick" OnAppointmentDataBound="RadScheduler1_AppointmentDataBound"
                    FirstDayOfWeek="Sunday" LastDayOfWeek="Saturday" OnFormCreated="RadScheduler1_FormCreated"   > 
                    <AppointmentTemplate>
                        <a href="#" onclick="return openPopup('/TV/Managerment/pgQuanLyTV.aspx?ID=<%#Eval("ID")%>');">
                           <asp:Image ID="imageWorkItem" ImageUrl="../Images/5.gif" runat="server"  Visible ='<%#(Eval("Value").ToString() == "1")%>' />
                        </a>
                        <%#Eval("Subject")%>                                               
                     </AppointmentTemplate>     
</telerik:RadScheduler>

AND now I want to hide fields Valueand IDColor in Advance Edit (and Insert Form ) . How do I do ? Can You show me !

Thank for help !

22 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 21 Jan 2008, 11:24 AM
Hi Nguyen,

Thank you for your interest in RadScheduler.

I am not sure what exactly you want to achieve, but perhaps the following will help you get started - 
please refer to the Templates online example. The code resposible for accessing the checkbox in the advanced form is:
 protected void RadScheduler1_AppointmentCommand(object sender, AppointmentCommandEventArgs e)  
        {  
            if(e.CommandName == "Insert")  
            {  
                CheckBox repeatCheck = (CheckBox)e.Container.FindControl("RepeatCheckBox");  
          

Should you have any other questions, please do not hesitate to contact us.



Cheers,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Peter
Telerik team
answered on 21 Jan 2008, 02:59 PM
Hi Nguyen,

Actually, perhaps you need to set EnableCustomAttributeEditing="False" for RadScheduler. Please, try this way and let us know if this is what you need.


Kind regards,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
uy_2008
Top achievements
Rank 2
answered on 22 Jan 2008, 02:44 AM
Hi Peter !
Thank for your Reply about my Question !

About my problem , I had tried All Event of Scheduler that relate with it  (That I think can do it (hide fields) ) ,
example: RadScheduler1_AppointmentDataBound,RadScheduler1_FormCreated,
RadScheduler1_AppointmentClick,... But Its can't do that (hide fields : ID,IDColor).
And About Event RadScheduler1_FormCreated(OR other Event that relate Attributes that declared in AdvancedEditTemplate,InlineEditTemplate,InlineInsertTemplate,..But not these Attributes that declared in telerik:RadScheduler it can't use these Event to call method 
FindControl)  it only use with fields that declared in

<AdvancedEditTemplate>....</AdvancedEditTemplate>,<InlineInsertTemplate>...</InlineInsertTemplate>
,...
Example:(http://www.telerik.com/DEMOS/ASPNET/Prometheus/Scheduler/Examples/Templates/DefaultCS.aspx)
<InlineInsertTemplate>
                <div id="InlineInsertTemplate" class="rsCustomAppointmentContainer <%# Eval("AppointmentType.Text") %>">
                    <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Subject") %>' Width="90%" TextMode="MultiLine" Height="20px"></asp:TextBox>
....
And then you can call attribute "
TitleTextBox" in Event RadScheduler1_FormCreated,RadScheduler1_AppointmentCommand,And maybe other Event ...

TextBox subjectBox = (TextBox)e.Container.FindControl("TitleTextBox");
                subjectBox.Text = e.Appointment.Subject;

And then can hide field by : subjectBox.Visible =false

But with Attribute ID,IDColor (that
declared in telerik:RadScheduler ) it can't do it , it can't use Method FindControl("ID") !!!! It can't call Method that .

And I had a solution to do that (hide fields :ID,IDColor) but it not Good ,reality not good :D . I do :

protected void RadScheduler1_AppointmentDataBound(object sender, SchedulerEventArgs e)
        {
            if (e.Appointment.Attributes["Value"] != null)
            {
                if (e.Appointment.Attributes["Value"].ToString() == "1")//Đây là WorkItem
                {
                    //do something
                }
                if (e.Appointment.Attributes["Value"].ToString() == "0")
                    e.Appointment.Attributes["Value"].Remove(0);//to hide it :D
            }
        }

And It can hide :D. But I think it can simpler that is !!!!








 
0
uy_2008
Top achievements
Rank 2
answered on 22 Jan 2008, 02:59 AM
Hi Nguyen,

Actually, perhaps you need to set EnableCustomAttributeEditing="False" for RadScheduler. Please, try this way and let us know if this is what you need.


Kind regards,
Peter
the Telerik team


Real Thank for your help , I have tried it and it do well !!!
But when I want to hide some fields(that template field) and visible some fields (that need to appear and to change it) (appear some fields) So I must set
EnableCustomAttributeEditing="true"
And use other way to do it ! can I do it ?

Thank you again about your help !
0
Peter
Telerik team
answered on 22 Jan 2008, 11:59 AM
Hello Nguyen,

This is an interesting scenario. Thanks for asking.

The good news is that there is a simple solution. Suppose you set:

 CustomAttributeNames="Value, IDColor" EnableCustomAttributeEditing="true"   

and you want to hide "IDColor" in the advanced form. You can do this as shown below:

 protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e)  
    {  
        WebControl lblNotes = (WebControl)e.Container.FindControl("LblAttrIDColor");  
        lblNotes.Visible = false;  
        WebControl lblNotes1 = (WebControl)e.Container.FindControl("AttrIDColor");  
        lblNotes1.Visible = false;  
    } 

If you need to hide the Value custom attribute, you will have to use FindControl("LblAttrValue") and FindControl("LblAttrValue").  

I hope this helps. Should you have any other questions, please feel free to contact us.


Regards,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
nguyen
Top achievements
Rank 1
answered on 23 Jan 2008, 07:19 AM
Hi Peter !
Thank for your solution ! I had tried and it worked very good !
But when visible that fields , it always appear form : TextBox !!!(maybe it's default field Custom Attributed ) . When I want to appear  (CustomAttribute fields) form : CheckBox when it's Value is bool (same field AllDayEvent ) , How can I do in instance ? Can you tell me ?

Thank,

Uy



P/S: my name is Uy (Nguyen Tien UY) )
0
nguyen
Top achievements
Rank 1
answered on 23 Jan 2008, 07:36 AM
Hi Peter !
I have a problem that relate your solution !!!!
With your solution , It only Appear custom attribute when delcare :
DataRecurrenceField="RecurrenceRule" DataRecurrenceParentKeyField="RecurrenceParentID"
If not declare 2 these fields It can't Appear Custom fields when use your solution !!!! I think custom field should independent with other fields in this instance !

Thank ,

Uy.


0
nguyen
Top achievements
Rank 1
answered on 23 Jan 2008, 07:51 AM
Hi Peter !

I think all of my problems can solve when use <AdvancedEditTemplate> but I think It's still can solve with defaulf Advanced Edit Template of RadScheduler Control So it not wasted a lot of time to do again !!!
I think why not create this Control same RadGrid Control ??? It very convenient for programmer to use it !!! ( same about solve with Template Form , Not All :D (Of course not !!! :D)).

Thank,

Uy.
0
Peter
Telerik team
answered on 23 Jan 2008, 03:23 PM
Hello Nguyen,

You are right that the custom attributes should not be affected by setting  DataRecurrenceField="RecurrenceRule" and DataRecurrenceParentKeyField="RecurrenceParentID". We will look deeper in this case as per your note.

Also, thank you for suggesting a way to improve RadScheduler. I will forward your opinion to our developers who will consider it.


All the best,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
nguyen
Top achievements
Rank 1
answered on 24 Jan 2008, 06:26 AM
hello Peter !
 Can you help me answer my previous Question :

"
When visible that fields (Custom fields), it always appear form : TextBox !!!(maybe it's default field Custom Attributed ) . When I want to appear  (CustomAttribute fields) form : CheckBox when it's Value is bool (same field AllDayEvent ) , How can I do in instance ? Can you tell me ? "

Thank ,

Uy.



0
Peter
Telerik team
answered on 24 Jan 2008, 11:54 AM
Hello Nguyen,

You can do this with Templates. Here is a simple example:

  <AdvancedEditTemplate> 
                   <asp:CheckBox ID="CheckBox1"  Checked='<%#Eval("CustomAttribute_BoolValueForCheckedState") %>' runat="server" /> 
                 
               </AdvancedEditTemplate> 


Is this what you need?


Cheers,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
nguyen
Top achievements
Rank 1
answered on 29 Jan 2008, 01:57 PM
Hi Peter !

Thank you for your reply ! I had used <AdvancedEditTemplate> Form to solve my problem !


0
Tam
Top achievements
Rank 1
answered on 28 Sep 2012, 03:58 AM
Hi uy_2008
Thank you very much!
0
Scorpy47
Top achievements
Rank 1
answered on 14 Mar 2013, 12:30 AM
Sorry to dig this up , but when you put visible=false, it takes a space unlike the display=none, is there a way to set the display = none for the fields? I tried setting like this (for example txtPurpose is a CustomAttribute
and
txtPurpose.Style.Add("display", "none"); (I event gave txtPurpose.CssClass="displayNone" , no effect)
                txtPurpose.DisabledStyle.CssClass = "displayNone";
does not remove the spaces, it still hides it. Any ideas to solve this or is there any trick I need to do here

displayNone is
.displayNone
        {
            display:none !important;
        }
0
Princy
Top achievements
Rank 2
answered on 14 Mar 2013, 07:16 AM
Hello,

It is possible to hide custom attributes using CSS. Suppose I want to hide the "All Day" option in Advanced Form, I will use the CSS as follows.

CSS:
<style type="text/css">
    .RadScheduler .rsAdvancedEdit .rsAdvChkWrap
    {
        display: none !important;
    }
</style>

Thanks,
Princy.
0
Scorpy47
Top achievements
Rank 1
answered on 14 Mar 2013, 07:22 AM
Thank you Princy. I get that, but say suppose I have two customattributes namely,
CustomAttributeNames="TotalPersons,WhatFor" and I want only whatfor to be hidden and not the totalpersons how to acheive this. Is there a way to do it? Thanks again
Regards,
Karthik
0
Plamen
Telerik team
answered on 15 Mar 2013, 07:31 AM
Hi Karthik,

 
I will recommend you for get the appropriate text box of the Custom Attribute as it shown in the Find the textbox for the annotations custom attribute and change its label section of this help topic and add the desired css styles to it.

Hope this will be helpful.

All the best,
Plamen
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.
0
bhenke
Top achievements
Rank 1
answered on 13 Feb 2015, 03:04 AM
Hi,

I have two custom attribute names defined for my RadScheduler.  They are "Location,UserName".  I want the location to be editable but the username is only there so that I can display it on the main RadScheduler screen.  I wish to hide the user name on the advanced edit form.  I am able to hide the actual field but not the label using the code below:

    Private Sub RadScheduler1_FormCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.SchedulerFormCreatedEventArgs) Handles RadScheduler1.FormCreated

        Dim lblNotes As WebControl = DirectCast(e.Container.FindControl("LblAttrUserName"), Label)
        lblNotes.Visible = False
        Dim attrUserNameTextbox As RadTextBox = DirectCast(e.Container.FindControl("AttrUserName"), RadTextBox)
        attrUserNameTextbox.Visible = False

The lblNotes.Visible line above throws an error because there is no control in the container called 'LblAttrUserName'.  How does one hide the label on the advanced for in addition to the actual field (textbox).

I am using the UI for ASP.NET AJAX Q3 2014 controls.

Thank you.
0
Plamen
Telerik team
answered on 18 Feb 2015, 05:55 AM
Hello,

You can refer to this help topic and find the custom attribute field as described in the Find the textbox for the annotations custom attribute and change its label section. If you want to hide the label you can set it to empty string and it will disappear since it is pasr of the RadTextBox element used in the advanced form.

Hope this will help you solve the issue.

Regards,
Plamen
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Josh
Top achievements
Rank 1
answered on 13 Oct 2015, 06:30 PM
[quote]Plamen said:Hello,

You can refer to this help topic and find the custom attribute field as described in the Find the textbox for the annotations custom attribute and change its label section. If you want to hide the label you can set it to empty string and it will disappear since it is pasr of the RadTextBox element used in the advanced form.

Hope this will help you solve the issue.

Regards,
Plamen
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 

[/quote]

 

Plamen,

I believe this feature is no longer working properly.

I am trying to remove the label (of a couple custom attributes) from the AdvancedForm of the RadScheduler and when I set the [RadTextBox].Label = "" or String.Empty nothing happens.  If I set the [RadTextBox].Label = "Test", it will actually insert another label next to the textbox and leave the other label in place. [See attached]


I also tried casting the webcontrol but ​no object is found.
    Dim lblResourceName As WebControl = DirectCast(e.Container.FindControl("LblAttr" + "Resource Name"), WebControl)

Thanks,

Josh​

0
Plamen
Telerik team
answered on 16 Oct 2015, 10:56 AM
Hello,

Thank you for your concern with Telerik controls.

We have updated the rendering of the advanced form and it seems that the article have become outdated. We will update it as soon as possible. Here is the code that worked correctly at my side:
protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
   {
       if ((e.Container.Mode == SchedulerFormMode.AdvancedEdit) || (e.Container.Mode == SchedulerFormMode.AdvancedInsert))
       {
           RadTextBox attrAnnotationsTextbox = (RadTextBox)e.Container.FindControl("AttrTest");
           ((LiteralControl)attrAnnotationsTextbox.Parent.Controls[0].Controls[0]).Text="Notes: ";
         
       }
   }

Hope this will help you solve the issue.

Regards,
Plamen
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Josh
Top achievements
Rank 1
answered on 16 Oct 2015, 01:28 PM

Thank you Plamen!  That works.

 

I also found that you can remove the entire row of the item by setting the visibility for the [textbox].parent.

 

((WebControl)attrAnnotationsTextbox.Parent).Visible == false;

 

Thanks,

Josh

Tags
Scheduler
Asked by
uy_2008
Top achievements
Rank 2
Answers by
Peter
Telerik team
uy_2008
Top achievements
Rank 2
nguyen
Top achievements
Rank 1
Tam
Top achievements
Rank 1
Scorpy47
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Plamen
Telerik team
bhenke
Top achievements
Rank 1
Josh
Top achievements
Rank 1
Share this question
or