Hide fields "CustomAttributeNames " in AdvancedEditTemplate

23 posts, 0 answers
  1. uy_2008
    uy_2008  avatar
    15 posts
    Member since:
    Jan 2008

    Posted 18 Jan 2008 Link to this post

    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 !
  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 21 Jan 2008 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 21 Jan 2008 Link to this post

    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
  5. uy_2008
    uy_2008  avatar
    15 posts
    Member since:
    Jan 2008

    Posted 21 Jan 2008 Link to this post

    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 !!!!








     
  6. uy_2008
    uy_2008  avatar
    15 posts
    Member since:
    Jan 2008

    Posted 21 Jan 2008 Link to this post

    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 !
  7. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 22 Jan 2008 Link to this post

    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
  8. nguyen
    nguyen avatar
    5 posts
    Member since:
    Dec 2007

    Posted 23 Jan 2008 Link to this post

    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) )
  9. nguyen
    nguyen avatar
    5 posts
    Member since:
    Dec 2007

    Posted 23 Jan 2008 Link to this post

    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.


  10. nguyen
    nguyen avatar
    5 posts
    Member since:
    Dec 2007

    Posted 23 Jan 2008 Link to this post

    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.
  11. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 23 Jan 2008 Link to this post

    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
  12. nguyen
    nguyen avatar
    5 posts
    Member since:
    Dec 2007

    Posted 24 Jan 2008 Link to this post

    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.



  13. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 24 Jan 2008 Link to this post

    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
  14. nguyen
    nguyen avatar
    5 posts
    Member since:
    Dec 2007

    Posted 29 Jan 2008 Link to this post

    Hi Peter !

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


  15. Tam
    Tam avatar
    2 posts
    Member since:
    Sep 2012

    Posted 27 Sep 2012 Link to this post

    Hi uy_2008
    Thank you very much!
  16. Karthik
    Karthik avatar
    19 posts
    Member since:
    Aug 2012

    Posted 13 Mar 2013 Link to this post

    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;
            }
  17. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 14 Mar 2013 Link to this post

    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.
  18. Karthik
    Karthik avatar
    19 posts
    Member since:
    Aug 2012

    Posted 14 Mar 2013 Link to this post

    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
  19. Plamen
    Admin
    Plamen avatar
    2729 posts

    Posted 15 Mar 2013 Link to this post

    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.
  20. bhenke
    bhenke avatar
    8 posts
    Member since:
    Sep 2006

    Posted 12 Feb 2015 in reply to Plamen Link to this post

    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.
  21. Plamen
    Admin
    Plamen avatar
    2729 posts

    Posted 17 Feb 2015 Link to this post

    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.

     
  22. Josh
    Josh avatar
    21 posts
    Member since:
    Mar 2007

    Posted 13 Oct 2015 in reply to Plamen Link to this post

    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.

     

     

    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​

  23. Plamen
    Admin
    Plamen avatar
    2729 posts

    Posted 16 Oct 2015 Link to this post

    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
  24. Josh
    Josh avatar
    21 posts
    Member since:
    Mar 2007

    Posted 16 Oct 2015 in reply to Plamen Link to this post

    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

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017