
Ken Walker
Top achievements
Rank 1
Ken Walker
asked on 04 Feb 2009, 12:19 PM
Hi Team,
We have facing some problem while integrating RadScheduler. Please see the below points :
1. We are using advanced template to insert/edit the appointment, we want to display the edit appointment screen when redirecting from another page of the website, we are passing appointment id in the query string and also Mode= Edit, but then also it is displaying the calendar screen. Please suggest.
2. We are using resource control dropdown for displaying the locations for user selection so we want to display the selected location details on the dropdown selected change to the same screen in a span but are unable to access the events. Please suggest the solution for the same.
Your early response will be highly appreciated.
Thanks.
7 Answers, 1 is accepted
0
Hi Ken,
1. You can use the ShowAdvancedEditForm method. For example:
2. Normally, you would be able to find the resource DropDownList control and attach to its SelectedIndexChanged event with in FormCreated using the following code:
(provided that you have a resource type with Name="Room").
However, because of a known issue with RadScheduler, you should use the following workaround:
Feel free to contact us if you have any further questions or concerns.
Kind regards,
Peter
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
1. You can use the ShowAdvancedEditForm method. For example:
protected void Page_Load(object sender, EventArgs e) |
{ |
string appointmentID = Request.QueryString["appID"]; |
string mode = Request.QueryString["Mode"]; |
if ((appointmentID != String.Empty)&(mode == "Edit")) |
{ |
RadScheduler1.DataBind(); |
Appointment a = RadScheduler1.Appointments.FindByID(Convert.ToInt32(appointmentID)); |
RadScheduler1.ShowAdvancedEditForm(a); |
} |
} |
2. Normally, you would be able to find the resource DropDownList control and attach to its SelectedIndexChanged event with in FormCreated using the following code:
protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e) |
{ |
if ((e.Container.Mode == SchedulerFormMode.AdvancedEdit) || (e.Container.Mode == SchedulerFormMode.AdvancedInsert)) |
{ |
DropDownList roomDdl = e.Container.FindControl("ResRoom") as DropDownList; |
roomDdl.AutoPostBack = true; |
roomDdl.SelectedIndexChanged += new EventHandler(roomDdl_SelectedIndexChanged); |
} |
} |
void roomDdl_SelectedIndexChanged(object sender, EventArgs e) |
{ |
DropDownList ddl1 = (DropDownList) sender; |
Label1.Text += ddl1.SelectedItem.Text + " "; |
} |
However, because of a known issue with RadScheduler, you should use the following workaround:
public void attachToResourceDdlEvent() |
{ |
if (RadScheduler1.Controls.Count == 0) |
return; // No child controls created yet. |
Control advForm = RadScheduler1.FindControl("Form"); |
if (advForm == null) |
return; // The advanced form is not visible. |
DropDownList roomDdl = advForm.FindControl("ResRoom") as DropDownList; |
if (roomDdl != null) |
{ |
roomDdl.AutoPostBack = true; |
roomDdl.SelectedIndexChanged += new EventHandler(roomDdl_SelectedIndexChanged); |
} |
} |
void roomDdl_SelectedIndexChanged(object sender, EventArgs e) |
{ |
DropDownList ddl1 = (DropDownList) sender; |
Label1.Text += ddl1.SelectedItem.Text + " "; |
} |
protected void Page_Load(object sender, EventArgs e) |
{ |
attachToResourceDdlEvent(); |
} |
protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e) |
{ |
attachToResourceDdlEvent(); |
} |
Feel free to contact us if you have any further questions or concerns.
Kind regards,
Peter
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0

Ken Walker
Top achievements
Rank 1
answered on 20 Feb 2009, 01:18 PM
Hi,
Regarding the second point, we have tried the suggested code but it is not working.
In the method attachToResourceDdlEvent()
Control advForm = RadScheduler1.FindControl("Form");
if (advForm == null)
return; // The advanced form is not visible.
the advForm is always null even we tried with the "ctl00_ContentPlaceHolder1_RadScheduler1_Form".
Also when using the below code e.container does not found any control:
DropDownList roomDdl = e.Container.FindControl("ResourceValue") as DropDownList;
DropDownList roomDdl = e.Container.FindControl"ctl00_ContentPlaceHolder1_RadScheduler1_Form_AdvancedEditForm1_AdvancedForm1_ResourceLocationId_ResourceValue") as DropDownList;
DropDownList roomDdl = e.Container.FindControl("LocationId") as DropDownList;
Please suggest.
Thanks.
Regarding the second point, we have tried the suggested code but it is not working.
In the method attachToResourceDdlEvent()
Control advForm = RadScheduler1.FindControl("Form");
if (advForm == null)
return; // The advanced form is not visible.
the advForm is always null even we tried with the "ctl00_ContentPlaceHolder1_RadScheduler1_Form".
Also when using the below code e.container does not found any control:
protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e) |
{ |
if ((e.Container.Mode == SchedulerFormMode.AdvancedEdit) || (e.Container.Mode == SchedulerFormMode.AdvancedInsert)) |
{ |
DropDownList roomDdl = e.Container.FindControl("ResRoom") as DropDownList; |
} |
} |
DropDownList roomDdl = e.Container.FindControl"ctl00_ContentPlaceHolder1_RadScheduler1_Form_AdvancedEditForm1_AdvancedForm1_ResourceLocationId_ResourceValue") as DropDownList;
DropDownList roomDdl = e.Container.FindControl("LocationId") as DropDownList;
Please suggest.
Thanks.
0
Hi Ken,
Attached is a small demo which shows that everything works as expected. Just add Telerik.Web.UI version 2008.3.1314 and test it. Note that because my resource type's Name is Room, I use
FindControl("ResRoom"). If you have let's say resource type with Name="User", you will use
FindControl("ResUser").
Regards,
Peter
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.
Attached is a small demo which shows that everything works as expected. Just add Telerik.Web.UI version 2008.3.1314 and test it. Note that because my resource type's Name is Room, I use
FindControl("ResRoom"). If you have let's say resource type with Name="User", you will use
FindControl("ResUser").
Regards,
Peter
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

Ken Walker
Top achievements
Rank 1
answered on 27 Feb 2009, 12:31 PM
Hi Team,
we have tried with the above suggested code but still the control is not found on the page, it always return a null vale after findcontrol(),
<telerik:radscheduler id="RadScheduler1" runat="server" customattributenames="Description" |
dataendfield="End" datakeyfield="ID" datarecurrencefield="RecurrenceRule" overflowbehavior="Expand" |
onappointmentinsert="RadScheduler1_AppointmentInsert" selectedview="MonthView" |
datarecurrenceparentkeyfield="RecurrenceParentID" startinsertinginadvancedform="true" |
onappointmentupdate="RadScheduler1_AppointmentUpdate" datasourceid="AppointmentsDataSource" |
OnAppointmentDelete="RadScheduler1_AppointmentDelete" OnFormCreated="RadScheduler1_FormCreated" |
skin="Office2007" onappointmentdatabound="RadScheduler1_AppointmentDataBound" |
datastartfield="Start" datasubjectfield="Subject" onnavigationcomplete="RadScheduler1_NavigationComplete" |
onappointmentclick="RadScheduler1_AppointmentClick" onformcreating="RadScheduler1_FormCreating" |
onappointmentcommand="RadScheduler1_AppointmentCommand"> |
<localization insert="Next" /> |
<ResourceTypes > |
<telerik:ResourceType DataSourceID="SqlUserLoaction" ForeignKeyField="LocationId" |
KeyField="ID" Name="LocationId" TextField="Location" /> |
</ResourceTypes> |
<AppointmentTemplate> |
<%--(<asp:Literal ID="AppointmentStartTime" runat="server" Text='<%# Eval("Start", "{0:t}") %>'></asp:Literal>) --%> |
<asp:Literal ID="AppoitmentEndTime" runat="server" Text='<%# Server.HtmlEncode(Eval("Start", "{0:t}")).Replace("\r","").Replace(" ","").Replace("\n","<br>").Replace(":00", "").Replace("PM", "p").Replace("AM", "a") %>'></asp:Literal>- |
<asp:Literal ID="AppointmentSubject" runat="server" Text='<%# Eval("Subject") %>'></asp:Literal> |
</AppointmentTemplate> |
<AdvancedEditTemplate> |
<div style="text-align: right;" class="rsAdvancedEdit"> |
<span style="cursor: pointer; cursor: hand;"> |
<asp:ImageButton runat="server" ID="Button1" ImageUrl="Images/add-event-to-outlook.jpg" AlternateText="Export to iCalendar" |
CommandName="Export" CommandArgument="Export" OnClientClick="Export(this, event); return false;" /> |
</span> |
</div> |
<scheduler:AdvancedEditForm runat="server" ID="AdvancedEditForm1" |
Subject='<%# Bind("Subject") %>' |
Start='<%# Bind("Start") %>' |
End='<%# Bind("End") %>' |
RecurrenceRuleText='<%# Bind("RecurrenceRule") %>' |
Description='<%# Bind("Description") %>' |
LocationId='<%# Bind("LocationId") %>' |
/> |
</AdvancedEditTemplate> |
<AdvancedInsertTemplate> |
<scheduler:AdvancedInsertForm runat="server" ID="AdvancedInsertForm1" |
Subject='<%# Bind("Subject") %>' |
Start='<%# Bind("Start") %>' |
End='<%# Bind("End") %>' |
RecurrenceRuleText='<%# Bind("RecurrenceRule") %>' |
Description='<%# Bind("Description") %>' |
LocationId='<%# Bind("LocationId") %>' |
/> |
</AdvancedInsertTemplate> |
</telerik:radscheduler> |
public void attachToResourceDdlEvent() |
{ |
if (RadScheduler1.Controls.Count == 0) |
return; // No child controls created yet. |
Control advForm = RadScheduler1.FindControl("Form"); |
if (advForm == null) |
return; // The advanced form is not visible. |
DropDownList roomDdl = advForm.FindControl("ResLocationId") as DropDownList; |
if (roomDdl != null) |
{ |
roomDdl.AutoPostBack = true; |
roomDdl.SelectedIndexChanged += new EventHandler(roomDdl_SelectedIndexChanged); |
} |
} |
But roomDdl is always null.
So we tried with different logic, please it below:
protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e) |
{ |
DropDownList ddls = new DropDownList(); |
//Control ResCtrl = e.Container.FindControl("AdvancedEditForm1").FindControl("AdvancedEdit").FindControl("AdvancedForm1").FindControl("AdvancedEditOptionsPanel").FindControl("AdvancedControlsPanel").FindControl("ResourceControls"); |
//ResCtrl = ResCtrl.FindControl("LocationId").FindControl("AttributeValue"); |
//attachToResourceDdlEvent(); |
if ((e.Container.Mode == SchedulerFormMode.AdvancedEdit) || (e.Container.Mode == SchedulerFormMode.AdvancedInsert)) |
{ |
for (int i = 0; i < e.Container.Controls.Count; i++) |
{ |
Control pchild= e.Container.Controls[i]; |
for (int j = 0; j < pchild.Controls.Count;j++ ) |
{ |
Control ccg=pchild.Controls[j]; |
//Response.Write(ccg.ClientID.ToString() + "</br>"); |
if (ccg.ID == "AdvancedForm1") |
{ |
for (int k = 0; k < ccg.Controls.Count; k++) |
{ |
Control ccg2 = ccg.Controls[k]; |
if (ccg2.ID == "AdvancedEditOptionsPanel") |
{ |
for(int z=0;z<ccg2.Controls.Count;z++) |
{ |
Control ccg3 = ccg2.Controls[z]; |
if (ccg3.ID == "AdvancedControlsPanel") |
{ |
for(int y=0;y<ccg3.Controls.Count;y++) |
{ |
Control ccg4 = ccg3.Controls[y]; |
if (ccg4.ID == "ResourceControls") |
{ |
if (!Equals(ccg4, null)) |
{ |
for (int x = 0; x < ccg4.Controls.Count; x++) |
{ |
Control ccg5 = ccg4.Controls[x]; |
//Response.Write("jai ho--->" + ccg5.ClientID.ToString() + "</br>"); |
for (int w = 0; w < ccg5.Controls.Count; w++) |
{ |
Control ccg6 = ccg5.Controls[x]; |
if (ccg5.ID == "ResourceLocationId") |
{ |
DropDownList ddl = ccg6.FindControl("ResourceValue") as DropDownList; |
if (!Equals(ddl, null)) |
{ |
ddl.AutoPostBack = true; |
ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged); |
// ddl.Attributes.Add("onchange", "LocationChange();"); |
} |
} |
} |
} |
} |
} |
} |
} |
} |
} |
} |
} |
} |
} |
} |
} |
We are able to trace the dropdown and also make the page postbak but it is not goint to the Event:
public void ddl_SelectedIndexChanged(object sender, EventArgs e) |
{ |
DropDownList ddl1 = (DropDownList)sender; |
lblMessage.Text += ddl1.SelectedItem.Text + " 123"; |
} |
Please suggest ASAP as it already took a lot of time for such a small requirement.
Thanks.
0
Hello Ken,
It was quite helpful that you sent us a code sample because it made it clear that you are using the custom user controls for the advanced templates. With this approach it is even easier to attach to the SelectedIndexChanged event of the resource dropdownlist control. You can simply extend the ResourceControl user control by adding a label and updating its Text property on SelectedIndexChanged of the resource dropdownlist.
Or, if you need to use the selected value for the resource to update any other control in the advanced form, you can dynamically find and handle the dropdownlist control in AdvancedForm. For example the following modification of the sample for customizing the advanced template will update the description with the selected resource:
AdvancedForm.ascx.cs:
Attached is a working demo (just add the telerik.web.ui assembly, version 2008.3.1314).
Greetings,
Peter
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.
It was quite helpful that you sent us a code sample because it made it clear that you are using the custom user controls for the advanced templates. With this approach it is even easier to attach to the SelectedIndexChanged event of the resource dropdownlist control. You can simply extend the ResourceControl user control by adding a label and updating its Text property on SelectedIndexChanged of the resource dropdownlist.
Or, if you need to use the selected value for the resource to update any other control in the advanced form, you can dynamically find and handle the dropdownlist control in AdvancedForm. For example the following modification of the sample for customizing the advanced template will update the description with the selected resource:
AdvancedForm.ascx.cs:
protected void Page_Load(object sender, EventArgs e) |
{ |
if (Owner.OverflowBehavior == OverflowBehavior.Scroll) |
{ |
AdvancedEditOptionsPanel.CssClass += " rsScrollingContent"; |
} |
ResourceControls.Visible = Owner.EnableResourceEditing; |
//if (ResourceControls.Visible) |
//{ |
DropDownList ddl = (DropDownList)ResourceControl1.FindControl("ResourceValue"); |
ddl.AutoPostBack = true; |
ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged); |
//} |
} |
void ddl_SelectedIndexChanged(object sender, EventArgs e) |
{ |
DropDownList ddl1 = sender as DropDownList; |
SchedulerDefaultForm1.Description += ddl1.SelectedItem.Text; |
} |
Attached is a working demo (just add the telerik.web.ui assembly, version 2008.3.1314).
Greetings,
Peter
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

Ken Walker
Top achievements
Rank 1
answered on 06 Mar 2009, 11:57 AM
hi Team,
thanks for your response, we are now able to get the event but we have one more query, please see the below scenario:
We are binding the dropdown with "ItemText" with the LocationName and "ItemValue" with the locationId, now when we access the dropdown selecteditem text on the ddl_SelectedIndexChanged event we get the correct text but not the correct value which is bind with the dropdown list. It gives some weard string type value.
Is it serializing the dropdown value? please suggest how to get the Id value from dropdown.
thanks
thanks for your response, we are now able to get the event but we have one more query, please see the below scenario:
We are binding the dropdown with "ItemText" with the LocationName and "ItemValue" with the locationId, now when we access the dropdown selecteditem text on the ddl_SelectedIndexChanged event we get the correct text but not the correct value which is bind with the dropdown list. It gives some weard string type value.
Is it serializing the dropdown value? please suggest how to get the Id value from dropdown.
thanks
0
Hello Ken,
You are right - we do in fact serialize the resource key to handle cases when the resource key is of type guid or string. You can go without serialization if it is of type int. In any case you can deserialize it like this:
Kind regards,
Peter
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.
You are right - we do in fact serialize the resource key to handle cases when the resource key is of type guid or string. You can go without serialization if it is of type int. In any case you can deserialize it like this:
void ddl_SelectedIndexChanged(object sender, EventArgs e) |
{ |
DropDownList ddl1 = sender as DropDownList; |
SchedulerDefaultForm1.Description += DeserializeResourceKey(ddl1.SelectedItem.Value); |
} |
private object DeserializeResourceKey(string key) |
{ |
LosFormatter input = new LosFormatter(); |
return input.Deserialize(key); |
} |
Kind regards,
Peter
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.