Hello,
Using Q3 2009 & IE7, I have the following scheduler code (advanced template code taken from here):
Here is the codebehind:
In particular, I am having great trouble with the combobox (on appointment insert); I simply cannot get the value of it. The string 'test' always returns null. If I try using DataValueField='<%# Bind("avail_type") %>' in the combobox, the string becomes empty instead. I simply wish to get the selected value of the combobox as a custom appointment attribute so that it may be stored in the database. Any help will be appreciated.
Thank you
Using Q3 2009 & IE7, I have the following scheduler code (advanced template code taken from here):
<telerik:RadScheduler ID="RadScheduler1" runat="server" OnAppointmentDelete="RadScheduler1_AppointmentDelete" |
OnAppointmentInsert="RadScheduler1_AppointmentInsert" OnAppointmentUpdate="RadScheduler1_AppointmentUpdate" |
Skin="WebBlue" OnDataBinding="RadScheduler1_DataBinding" SelectedView="WeekView" |
StartEditingInAdvancedForm="true" StartInsertingInAdvancedForm="true" ShowAllDayRow="false" |
OnAppointmentDataBound="RadScheduler1_AppointmentDataBound" |
CustomAttributeNames="avail_type" EnableCustomAttributeEditing="true"> |
<AdvancedForm Modal="true" /> |
<TimelineView UserSelectable="false" /> |
<AdvancedInsertTemplate> |
<div class="rsAdvancedEdit" style="position: relative"> |
<%-- Title bar.--%> |
<div class="rsAdvTitle"> |
<%-- The rsAdvInnerTitle element is used as a drag handle when the form is modal. --%> |
<h1 class="rsAdvInnerTitle"> |
<asp:Label runat="server" ID="titleBarLabel"> |
<%# Container.Appointment.Owner.Localization.GetString("AdvancedInsertTitleBar_Callback")%> |
</asp:Label></h1> |
<asp:LinkButton runat="server" ID="AdvancedEditCloseButton" CssClass="rsAdvEditClose" |
CommandName="Cancel" CausesValidation="false" ToolTip='<%# Container.Appointment.Owner.Localization.AdvancedClose %>'> |
<%# Container.Appointment.Owner.Localization.AdvancedClose%> |
</asp:LinkButton> |
</div> |
<div class="rsAdvContentWrapper"> |
<table> |
<tr><td> |
<asp:Label runat="server" ID="AvailabilityLabel"> |
<%# Container.Appointment.Owner.Localization.GetString("AvailabilityLabel_Callback")%> |
</asp:Label> |
</td> |
<td> |
<telerik:RadComboBox runat="server" ID="AvailComboBox" OnDataBinding="AvailComboBox_DataBinding" Skin="WebBlue" DataValueField="avail_type" DataTextField="avail_name" HighlightTemplatedItems="True" EmptyMessage='<%# Container.Appointment.Owner.Localization.Save %>'> |
<ItemTemplate> |
<asp:Image runat="server" ID="AvailabilityDDImage" ImageUrl='<%# "~/images/colors/" + Eval("color").ToString().Trim() + ".gif" %>' ToolTip='<%# "~/images/colors/" + Eval("color").ToString().Trim() + ".gif" %>' /> |
<asp:Label runat="server" ID="AvailabilityDDLabel" Text='<%# Eval("avail_name") %>'></asp:Label> |
<asp:HiddenField runat="server" ID="hidAvailType" Value='<%# Bind("avail_type") %>' /> |
</ItemTemplate> |
</telerik:RadComboBox> |
</td> |
</tr> |
</table> |
Custom content here... |
<asp:Panel runat="server" ID="ButtonsPanel" CssClass="rsAdvancedSubmitArea"> |
<div class="rsAdvButtonWrapper"> |
<asp:LinkButton CommandName="Insert" runat="server" ID="InsertButton" CssClass="rsAdvEditSave"> |
<span><%# Container.Appointment.Owner.Localization.Save%></span> |
</asp:LinkButton> |
<asp:LinkButton runat="server" ID="CancelButton" CssClass="rsAdvEditCancel" CommandName="Cancel" |
CausesValidation="false"> |
<span><%# Container.Appointment.Owner.Localization.Cancel%></span> |
</asp:LinkButton> |
</div> |
</asp:Panel> |
</div> |
</div> |
</AdvancedInsertTemplate> |
</telerik:RadScheduler> |
Here is the codebehind:
protected void RadScheduler1_AppointmentInsert(object sender, SchedulerCancelEventArgs e) |
{ |
string test = e.Appointment.Attributes["avail_type"]; |
} |
protected void RadScheduler1_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e) |
{ |
} |
protected void RadScheduler1_AppointmentDelete(object sender, SchedulerCancelEventArgs e) |
{ |
} |
protected void AvailComboBox_DataBinding(object sender, EventArgs e) |
{ |
(sender as RadComboBox).Items.Clear(); |
DataTable table = new DataTable(); |
table.Columns.Add("color"); |
table.Columns.Add("avail_name"); |
table.Columns.Add("avail_type"); |
DataRow row = table.NewRow(); |
row["color"] = "Green"; |
row["avail_name"] = "Available"; |
row["avail_type"] = "AVAIL"; |
table.Rows.Add(row); |
row = table.NewRow(); |
row["color"] = "Red"; |
row["avail_name"] = "Not Available"; |
row["avail_type"] = "NOTAVAIL"; |
table.Rows.Add(row); |
DataView AvailabilityView = table.DefaultView; |
(sender as RadComboBox).DataSource = AvailabilityView; |
(sender as RadComboBox).SelectedIndex = 0; |
} |
In particular, I am having great trouble with the combobox (on appointment insert); I simply cannot get the value of it. The string 'test' always returns null. If I try using DataValueField='<%# Bind("avail_type") %>' in the combobox, the string becomes empty instead. I simply wish to get the selected value of the combobox as a custom appointment attribute so that it may be stored in the database. Any help will be appreciated.
Thank you