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
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
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
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 !!!!
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 !
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
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) )
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.
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.
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
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.
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 ? "
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
Thank you for your reply ! I had used
<AdvancedEditTemplate> Form to solve my problem !
Thank you very much!
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;
}
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.
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
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.
Plamen
the Telerik team
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.
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.
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
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
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