7 Answers, 1 is accepted
It's me again, actually I would like to know that how to find out the control in AdvancedInsertTemplate when FormCreated event of RadScheduler occurring.
Thanks
ok, I found the way to do this, just like find out the contol in Inlinetemplae, right ?
Please, refer to the Templates online example. The code responsible for finding a control in the Advanced Indsert Template is:
| protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e) |
| { |
| RadScheduler scheduler = (RadScheduler) sender; |
| if (e.Container.Mode == SchedulerFormMode.AdvancedInsert || e.Container.Mode == SchedulerFormMode.AdvancedEdit) |
| { |
| TextBox subjectBox = (TextBox)e.Container.FindControl("TitleTextBox"); |
| subjectBox.Text = e.Appointment.Subject; |
| RadDateInput startInput = (RadDateInput)e.Container.FindControl("StartInput"); |
| startInput.DateFormat = scheduler.EditFormDateFormat + " " + scheduler.EditFormTimeFormat; |
| startInput.SelectedDate = RadScheduler1.DisplayToUtc(e.Appointment.Start); |
| RadDateInput endInput = (RadDateInput)e.Container.FindControl("EndInput"); |
| endInput.DateFormat = scheduler.EditFormDateFormat + " " + scheduler.EditFormTimeFormat; |
| endInput.SelectedDate = RadScheduler1.DisplayToUtc(e.Appointment.End); |
| } |
| } |
Regards,
Peter
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
First at all, Thanks for answering, and I have another question, I have our own form in advancedinsertTemlate, when insert into table, the Suject and ID is missing, we cannot find out the problem, please help me out, there is our code below. Thanks again.
--- RadScheduler ---
<telerik:RadScheduler ID="RadScheduler1" runat="server" Skin="Office2007" DataSourceID="SqlDataSource1" CustomAttributeNames="RESOURCE_ID,DESP,REMARK,EMP_NO" DataEndField="E_DATE"
DataKeyField="ID" DataRecurrenceField="RECURRENCERULE" DataRecurrenceParentKeyField="RECURRENCEPARENTID"
DataStartField="S_DATE" DataSubjectField="TITLE" OnFormCreated="RadScheduler1_FormCreated"
Culture="Chinese (Taiwan)" OnFormCreating="RadScheduler1_FormCreating" StartInsertingInAdvancedForm="True"
OnAppointmentCommand="RadScheduler1_AppointmentCommand" SelectedView="WeekView"
AllowDelete="True" AllowEdit="True" AllowInsert="True" HoursPanelTimeFormat="tt hh:mm"
OnAppointmentCreated="RadScheduler1_AppointmentCreated" SelectedDate="2007-10-22"
DataMember="DefaultView" OnAppointmentDataBound="RadScheduler1_AppointmentDataBound"
OverflowBehavior="Expand" DayEndTime="22:00:00" DayStartTime="06:00:00" WorkDayEndTime="18:00:00">
<AdvancedInsertTemplate>
<table width="650px" align="center">
<tr>
<td colspan="4">
<asp:Panel ID="Panel4" runat="server" GroupingText="會議主旨">
<asp:TextBox ID="TextBoxTitle" runat="server" Width="95%" TextMode="MultiLine"></asp:TextBox></asp:Panel>
</td>
</tr>
<tr>
<td colspan="4">
<asp:Panel ID="Panel5" runat="server" GroupingText="會議概要">
<asp:TextBox ID="TextBoxDesp" runat="server" TextMode="MultiLine" Width="95%"></asp:TextBox></asp:Panel>
</td>
</tr>
<tr>
<td style="width: 100px" align="right">
<asp:Label ID="Label3" runat="server" Text="召集人"></asp:Label></td>
<td style="width: 270px">
<uc5:ASP_EMPCombo ID="ASP_EMPCombo1" runat="server" />
</td>
<td style="width: 100px" align="right">
<asp:Label ID="Label7" runat="server" Text="建檔人"></asp:Label></td>
<td style="width: 270px">
<uc6:ASP_KeyInCombo ID="ASP_KeyInCombo1" runat="server" />
</td>
</tr>
<tr>
<td style="width: 100px" align="right" valign="middle">
<asp:Label ID="Label4" runat="server" Text="出席人員"></asp:Label>
<asp:ImageButton ID="ImageButtonTypeA" runat="server" ImageUrl="~/images/jam/PNG_32/adminadd_16.png" />
</td>
<td colspan="3">
<asp:TextBox ID="TextBoxTypeA" runat="server" ReadOnly="True" TextMode="MultiLine"
Width="90%"></asp:TextBox></td>
</tr>
<tr>
<td align="right" style="width: 100px">
<asp:Label ID="Label5" runat="server" Text="列席人員"></asp:Label>
<asp:ImageButton ID="ImageButtonTypeB" runat="server" ImageUrl="~/images/jam/PNG_32/adminadd_16.png" /></td>
<td colspan="3">
<asp:TextBox ID="TextBoxTypeB" runat="server" ReadOnly="True" TextMode="MultiLine"
Width="90%"></asp:TextBox></td>
</tr>
<tr>
<td style="width: 100px" align="right">
<asp:Label ID="Label1" runat="server" Text="知會人員"></asp:Label>
<asp:ImageButton ID="ImageButtonTypeC" runat="server" ImageUrl="~/images/jam/PNG_32/adminadd_16.png" /></td>
<td colspan="3">
<asp:TextBox ID="TextBoxTypeC" runat="server" ReadOnly="True" TextMode="MultiLine"
Width="90%"></asp:TextBox></td>
</tr>
<tr>
<td style="width: 100px" align="right">
<asp:Label ID="Label9" runat="server" Text="會議地點"></asp:Label></td>
<td style="width: 270px">
<asp:DropDownList ID="RadComboBoxRoom" runat="server" DataSourceID="SqlDataSource2"
DataTextField="NAME" DataValueField="ROOMID" Width="130px" AppendDataBoundItems="True"
DataMember="DefaultView">
<asp:ListItem Value="All">全部</asp:ListItem>
</asp:DropDownList>
</td>
<td style="width: 100px" align="right">
<asp:Label ID="Label12" runat="server" Text="與會人數"></asp:Label></td>
<td style="width: 270px">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 99px">
<asp:Label ID="Label8" runat="server" Text="備註說明"></asp:Label></td>
<td colspan="3">
<asp:TextBox ID="TextBoxREMARK" runat="server" TextMode="MultiLine" Width="90%"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="4" style="height: auto">
<div style="width: auto">
<table cellpadding="0" cellspacing="0" class="frmControls" style="margin-top: 16px;
width: 650px;">
<tbody>
<tr>
<td style="width: 80px">
<div style="margin-top: 7px; text-align: right;">
<asp:Label runat="server" ID="aptStrat" Text="開始日期:" meta:resourcekey="aptStratResource1"></asp:Label>
</div>
</td>
<td style="width: 200px">
<telerik:RadDatePicker ID="RadDatePicker1" runat="server" MinDate="2006-01-01" SelectedDate="2006-12-24"
SharedCalendarID="sharedCalendar" Width="100px" Culture="Chinese (Taiwan)" FocusedDate="2006-01-01"
meta:resourcekey="RadDatePicker1Resource1">
<DateInput ID="DateInput1" Height="100%" SelectedDate="2006-12-24" Width="100%" runat="server">
</DateInput>
<Calendar ID="Calendar1" Skin="Sunny" UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False"
runat="server">
</Calendar>
<DatePopupButton CssClass="radPopupImage_Sunny" />
</telerik:RadDatePicker>
<telerik:RadTimePicker ID="RadTimePicker1" runat="server" Width="90px" Culture="Chinese (Taiwan)"
meta:resourcekey="RadTimePicker1Resource1">
<DateInput ID="DateInput2" DateFormat="h:mm tt" LabelCssClass="" runat="server">
</DateInput>
<TimeView ID="TimeView1" StartTime="06:00:00" EndTime="23:31:00" Interval="00:30:00"
Columns="6" TimeFormat="HH:mm" UseAccessibleHeader="False" Culture="Chinese (Taiwan)"
runat="server">
</TimeView>
<DatePopupButton Visible="False"></DatePopupButton>
</telerik:RadTimePicker>
</td>
<td style="width: 80px">
<div style="margin-top: 7px; margin-left: 10px; text-align: right;">
<asp:Label runat="server" ID="aptEnd" Text="結束日期:" meta:resourcekey="aptEndResource1"></asp:Label>
</div>
</td>
<td style="width: 200px">
<label for="RadDatePicker2">
</label>
<telerik:RadDatePicker ID="RadDatePicker2" runat="server" MinDate="2006-01-01" SelectedDate="2006-12-24"
SharedCalendarID="sharedCalendar" Width="100px" Culture="Chinese (Taiwan)" FocusedDate="2006-01-01"
meta:resourcekey="RadDatePicker2Resource1">
<DateInput ID="DateInput3" Height="100%" SelectedDate="2006-12-24" Width="100%" runat="server">
</DateInput>
<Calendar ID="Calendar2" Skin="Sunny" UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False"
runat="server">
</Calendar>
<DatePopupButton CssClass="radPopupImage_Sunny" />
</telerik:RadDatePicker>
<telerik:RadTimePicker ID="RadTimePicker2" runat="server" Width="90px" Culture="Chinese (Taiwan)"
meta:resourcekey="RadTimePicker2Resource1">
<DateInput ID="DateInput4" DateFormat="h:mm tt" LabelCssClass="" runat="server">
</DateInput>
<TimeView ID="TimeView2" StartTime="06:00:00" EndTime="23:31:00" Interval="00:30:00"
Columns="6" TimeFormat="HH:mm" UseAccessibleHeader="False" Culture="Chinese (Taiwan)"
runat="server">
</TimeView>
<DatePopupButton Visible="False"></DatePopupButton>
</telerik:RadTimePicker>
</td>
<td>
<asp:CheckBox ID="CheckBoxAllDay" runat="server" Text="全天" meta:resourcekey="CheckBoxAllDayResource1" /></td>
</tr>
<tr>
<td colspan="99" style="height: 32px">
<asp:CheckBox ID="CheckBoxEnableRecurrenced" runat="server" BorderStyle="None" OnClick="cbClick()"
Text="週期性" Width="103px" meta:resourcekey="CheckBoxEnableRecurrencedResource1" /></td>
</tr>
</tbody>
</table>
<asp:Panel ID="Panel1" runat="server" Height="50px" Width="740px" meta:resourcekey="Panel1Resource2"
GroupingText="循環模式">
<table width="100%" style="height: 300px">
<tr>
<td width="20%" valign="top">
<asp:RadioButtonList ID="RadioButtonList1" runat="server" BorderStyle="None" Width="110px"
meta:resourcekey="RadioButtonList1Resource1" onclick="getRadioValue(this)">
<asp:ListItem Value="H" meta:resourcekey="ListItemResource6">小時</asp:ListItem>
<asp:ListItem Value="D" meta:resourcekey="ListItemResource2" Text="每天"></asp:ListItem>
<asp:ListItem Value="W" meta:resourcekey="ListItemResource3" Text="每週"></asp:ListItem>
<asp:ListItem Value="M" meta:resourcekey="ListItemResource4" Text="每月"></asp:ListItem>
<asp:ListItem Value="Y" meta:resourcekey="ListItemResource5" Text="每年"></asp:ListItem>
</asp:RadioButtonList>
</td>
<td align="left" valign="top" style="width: 596px">
<asp:Panel ID="PanelHourly" runat="server" HorizontalAlign="Justify" Width="100%"
meta:resourcekey="PanelHourlyResource1">
<asp:Label ID="LabelHREvery" runat="server" Text="每" meta:resourcekey="LabelHREveryResource1"></asp:Label>
<radI:RadNumericTextBox ID="RadNumericTextBoxHours" runat="server" Width="50px" MaxValue="999"
MinValue="1" Culture="Chinese (Taiwan)" meta:resourcekey="RadNumericTextBoxHoursResource1"
Skin="" MaxLength="3" Text="1">
</radI:RadNumericTextBox>
<asp:Label ID="LabelHRHours" runat="server" Text="小時" meta:resourcekey="LabelHRHoursResource1"></asp:Label></asp:Panel>
<asp:Panel ID="PanelDDays" runat="server" Width="100%" meta:resourcekey="PanelDDaysResource1">
<table width="100%">
<tr>
<td style="height: 24px">
<asp:RadioButton ID="RadioButtonDEveryDay" runat="server" GroupName="DayOption" Text="每"
meta:resourcekey="RadioButtonDEveryDayResource1" Checked="true" /> <radI:RadNumericTextBox
ID="RadNumericTextBoxDDaysCount" runat="server" Width="50px" MaxValue="999" MinValue="1"
Text="1" Culture="Chinese (Taiwan)" meta:resourcekey="RadNumericTextBoxDDaysCountResource1"
Skin="" Value="1">
<NumberFormat DecimalDigits="0" />
</radI:RadNumericTextBox>
<asp:Label ID="LabelDDays" runat="server" Text="天" meta:resourcekey="LabelDDaysResource1"></asp:Label></td>
</tr>
<tr>
<td style="height: 24px">
<asp:RadioButton ID="RadioButtonDEveryWorkDay" runat="server" GroupName="DayOption"
Text="每個工作日" meta:resourcekey="RadioButtonDEveryWorkDayResource1" /></td>
</tr>
</table>
</asp:Panel>
<asp:Panel ID="PanelWeekly" runat="server" Width="100%" meta:resourcekey="PanelWeeklyResource1">
<table width="100%">
<tr>
<td>
<asp:Label ID="LabelWEveryWeeks" runat="server" Text="重覆於每" meta:resourcekey="LabelWEveryWeeksResource1"></asp:Label> <radI:RadNumericTextBox
ID="RadNumericTextBoxWCounts" runat="server" Width="50px" MaxValue="999" MinValue="1"
Text="1" Culture="Chinese (Taiwan)" meta:resourcekey="RadNumericTextBoxWCountsResource1"
Skin="" Value="1">
<NumberFormat DecimalDigits="0" />
</radI:RadNumericTextBox>
<asp:Label ID="LabelWofWeek" runat="server" Text="週的" meta:resourcekey="LabelWofWeekResource1"></asp:Label></td>
</tr>
<tr>
<td>
<asp:CheckBoxList ID="CheckBoxListWeek" runat="server" RepeatColumns="4" RepeatDirection="Horizontal"
meta:resourcekey="CheckBoxListWeekResource1">
<asp:ListItem Value="Sunday" meta:resourcekey="ListItemResource7">星期日</asp:ListItem>
<asp:ListItem Value="Monday" meta:resourcekey="ListItemResource8">星期一</asp:ListItem>
<asp:ListItem Value="Tuesday" meta:resourcekey="ListItemResource9">星期二</asp:ListItem>
<asp:ListItem Value="Wednesday" meta:resourcekey="ListItemResource10">星期三</asp:ListItem>
<asp:ListItem Value="Thursday" meta:resourcekey="ListItemResource11">星期四</asp:ListItem>
<asp:ListItem Value="Friday" meta:resourcekey="ListItemResource12">星期五</asp:ListItem>
<asp:ListItem Value="Saturday" meta:resourcekey="ListItemResource13">星期六</asp:ListItem>
</asp:CheckBoxList></td>
</tr>
</table>
</asp:Panel>
<asp:Panel ID="PanelMonthly" runat="server" Width="100%">
<table width="100%">
<tr>
<td style="height: 24px">
<asp:RadioButton ID="RadioButtonMEveryA" runat="server" GroupName="DayOption" Text="每"
meta:resourcekey="RadioButtonDEveryDayResource1" Checked="true" /> <radI:RadNumericTextBox
ID="RadNumericTextBoxMCountsA" runat="server" Width="50px" MaxValue="999" MinValue="1"
Text="1" Culture="Chinese (Taiwan)" meta:resourcekey="RadNumericTextBoxDDaysCountResource1"
Skin="" Value="1">
<NumberFormat DecimalDigits="0" />
</radI:RadNumericTextBox>
<asp:Label ID="LabelMonlyofA" runat="server" Text="個月的" meta:resourcekey="LabelDDaysResource1"></asp:Label> <radI:RadNumericTextBox
ID="RadNumericTextBoxMCountADay" runat="server" Width="50px" MaxValue="999" MinValue="1"
Text="1" Culture="Chinese (Taiwan)" meta:resourcekey="RadNumericTextBoxDDaysCountResource1"
Skin="" Value="1">
<NumberFormat DecimalDigits="0" />
</radI:RadNumericTextBox>
<asp:Label ID="Label11" runat="server" meta:resourcekey="LabelDDaysResource1" Text="日"></asp:Label></td>
</tr>
<tr>
<td>
<asp:RadioButton ID="RadioButtonMEveryE" runat="server" GroupName="DayOption" Text="每"
meta:resourcekey="RadioButtonDEveryWorkDayResource1" /> <radI:RadNumericTextBox
ID="RadNumericTextBoxMCountsE" runat="server" Width="50px" MaxValue="999" MinValue="1"
Text="1" Culture="Chinese (Taiwan)" meta:resourcekey="RadNumericTextBoxDDaysCountResource1"
Skin="" Value="1">
<NumberFormat DecimalDigits="0" />
</radI:RadNumericTextBox>
<asp:Label ID="LabelMonlyofE" runat="server" meta:resourcekey="LabelDDaysResource1"
Text="個月的"></asp:Label> <asp:DropDownList ID="DropDownListMDayOrdinal" runat="server">
<asp:ListItem Value="1">第一個</asp:ListItem>
<asp:ListItem Value="2">第二個</asp:ListItem>
<asp:ListItem Value="3">第三個</asp:ListItem>
<asp:ListItem Value="4">第四個</asp:ListItem>
<asp:ListItem Value="-1">最後一個</asp:ListItem>
</asp:DropDownList> <asp:DropDownList ID="DropDownListMRecurrenceDay" runat="server">
<asp:ListItem Value="day">日</asp:ListItem>
<asp:ListItem Value="weekday">週一到週五</asp:ListItem>
<asp:ListItem Value="weekend day">週末</asp:ListItem>
<asp:ListItem Value="Sunday">星期日</asp:ListItem>
<asp:ListItem Value="Monday">星期一</asp:ListItem>
<asp:ListItem Value="Tuesday">星期二</asp:ListItem>
<asp:ListItem Value="Wednesday">星期三</asp:ListItem>
<asp:ListItem Value="Thursday">星期四</asp:ListItem>
<asp:ListItem Value="Friday">星期五</asp:ListItem>
<asp:ListItem Value="Saturday">星期六</asp:ListItem>
</asp:DropDownList></td>
</tr>
</table>
</asp:Panel>
<asp:Panel ID="PanelYearly" runat="server" Width="100%">
<table width="100%">
<tr>
<td style="height: 24px">
<asp:RadioButton ID="RadioButtonYEvery" runat="server" GroupName="DayOption" Text="每年"
meta:resourcekey="RadioButtonDEveryDayResource1" Checked="True" /> <asp:DropDownList
ID="DropDownListYearlyV" runat="server" Width="60px">
<asp:ListItem Value="1">一月</asp:ListItem>
<asp:ListItem Value="2">二月</asp:ListItem>
<asp:ListItem Value="3">三月</asp:ListItem>
<asp:ListItem Value="4">四月</asp:ListItem>
<asp:ListItem Value="5">五月</asp:ListItem>
<asp:ListItem Value="6">六月</asp:ListItem>
<asp:ListItem Value="7">七月</asp:ListItem>
<asp:ListItem Value="8">八月</asp:ListItem>
<asp:ListItem Value="9">九月</asp:ListItem>
<asp:ListItem Value="10">十月</asp:ListItem>
<asp:ListItem Value="11">十一月</asp:ListItem>
<asp:ListItem Value="12">十二月</asp:ListItem>
</asp:DropDownList>
<radI:RadNumericTextBox ID="RadNumericTextBoxYearlyDay" runat="server" Width="50px"
MaxValue="31" MinValue="1" Text="1" Culture="Chinese (Taiwan)" meta:resourcekey="RadNumericTextBoxDDaysCountResource1"
Skin="" Value="1">
<NumberFormat DecimalDigits="0" />
</radI:RadNumericTextBox>
<asp:Label ID="LabelYearlyday" runat="server" meta:resourcekey="LabelDDaysResource1"
Text="日"></asp:Label></td>
</tr>
<tr>
<td>
<asp:RadioButton ID="RadioButtonYearlyOn" runat="server" GroupName="DayOption" Text="在"
meta:resourcekey="RadioButtonDEveryWorkDayResource1" /> <asp:DropDownList ID="DropDownListYearlyE"
runat="server" Width="60px">
<asp:ListItem Value="1">一月</asp:ListItem>
<asp:ListItem Value="2">二月</asp:ListItem>
<asp:ListItem Value="3">三月</asp:ListItem>
<asp:ListItem Value="4">四月</asp:ListItem>
<asp:ListItem Value="5">五月</asp:ListItem>
<asp:ListItem Value="6">六月</asp:ListItem>
<asp:ListItem Value="7">七月</asp:ListItem>
<asp:ListItem Value="8">八月</asp:ListItem>
<asp:ListItem Value="9">九月</asp:ListItem>
<asp:ListItem Value="10">十月</asp:ListItem>
<asp:ListItem Value="11">十一月</asp:ListItem>
<asp:ListItem Value="12">十二月</asp:ListItem>
</asp:DropDownList>
<asp:Label ID="LabelYearlyof" runat="server" meta:resourcekey="LabelDDaysResource1"
Text="的"></asp:Label> <asp:DropDownList ID="DropDownListYDayOrdinal" runat="server">
<asp:ListItem Value="1">第一個</asp:ListItem>
<asp:ListItem Value="2">第二個</asp:ListItem>
<asp:ListItem Value="3">第三個</asp:ListItem>
<asp:ListItem Value="4">第四個</asp:ListItem>
<asp:ListItem Value="-1">最後一個</asp:ListItem>
</asp:DropDownList> <asp:DropDownList ID="DropDownListYRecurrenceDay" runat="server">
<asp:ListItem Value="day">日</asp:ListItem>
<asp:ListItem Value="weekday">週一到週五</asp:ListItem>
<asp:ListItem Value="weekend day">週末</asp:ListItem>
<asp:ListItem Value="Sunday">星期日</asp:ListItem>
<asp:ListItem Value="Monday">星期一</asp:ListItem>
<asp:ListItem Value="Tuesday">星期二</asp:ListItem>
<asp:ListItem Value="Wednesday">星期三</asp:ListItem>
<asp:ListItem Value="Thursday">星期四</asp:ListItem>
<asp:ListItem Value="Friday">星期五</asp:ListItem>
<asp:ListItem Value="Saturday">星期六</asp:ListItem>
</asp:DropDownList></td>
</tr>
</table>
</asp:Panel>
</td>
</tr>
<tr>
<td colspan="2">
<asp:Panel ID="Panel2" runat="server" GroupingText="循環範圍">
<table width="100%">
<tr>
<td colspan="2">
<asp:RadioButton ID="RadioButtonNoEnd" runat="server" Checked="True" GroupName="RecurrenceRange"
Text="沒有結束日期" meta:resourcekey="RadioButtonNoEndResource1" /></td>
</tr>
<tr>
<td width="80">
<asp:RadioButton ID="RadioButtonRepeat" runat="server" GroupName="RecurrenceRange"
Text="在反覆" meta:resourcekey="RadioButtonRepeatResource1" /></td>
<td>
<radI:RadNumericTextBox ID="RadNumericTextBoxMaxRecurs" runat="server" MaxValue="999"
MinValue="1" Width="50px" Culture="Chinese (Taiwan)" meta:resourcekey="RadNumericTextBox1Resource1"
Skin="">
<NumberFormat DecimalDigits="0" />
</radI:RadNumericTextBox>次後結束</td>
</tr>
<tr>
<td width="80">
<asp:RadioButton ID="RadioButtonDateEnd" runat="server" GroupName="RecurrenceRange"
Text="結束於" meta:resourcekey="RadioButtonDateEndResource1" /></td>
<td>
<telerik:RadDatePicker ID="RadDatePickerRangDate" runat="server" MinDate="2006-01-01"
SelectedDate="2006-12-24" SharedCalendarID="sharedCalendar" Width="100px" Culture="Chinese (Taiwan)"
FocusedDate="2006-01-01" meta:resourcekey="RadDatePicker1Resource1">
<DateInput ID="DateInput5" LabelCssClass="" runat="server">
</DateInput>
<Calendar ID="Calendar3" Skin="Sunny" runat="server">
</Calendar>
</telerik:RadDatePicker>
</td>
</tr>
</table>
</asp:Panel>
</td>
</tr>
</table>
</asp:Panel>
<telerik:RadCalendar ID="sharedCalendar" runat="server" EnableMultiSelect="False"
RangeMinDate="2006-01-01" Skin="Sunny" CultureInfo="Chinese (Taiwan)" FocusedDate="2006-01-01"
meta:resourcekey="sharedCalendarResource1" SelectedDate="">
</telerik:RadCalendar>
</div>
</td>
</tr>
<tr>
<td colspan="4" align="center">
<asp:ImageButton ID="ImageButtonSave" runat="server" ImageUrl="~/images/jam/ok.gif"
CommandName="Insert" />
<asp:ImageButton ID="ImageButtonCancel" runat="server" ImageUrl="~/images/jam/cancel.gif"
CommandName="Cancel" /></td>
</tr>
</table>
</AdvancedInsertTemplate>
<Localization AdvancedAllDayEvent="全天會議" />
</telerik:RadScheduler>
AppointmentCommand event
protected void RadScheduler1_AppointmentCommand(object sender, AppointmentCommandEventArgs e)
{
if (e.CommandName == "Insert")
{
//Gen Guid when new a meeting.
string guidstr = System.Guid.NewGuid().ToString("N");
RadScheduler scheduler = (RadScheduler)sender;
Telerik.Web.UI.RadDatePicker datestart = e.Container.FindControl("RadDatePicker1") as Telerik.Web.UI.RadDatePicker;
Telerik.Web.UI.RadTimePicker timestart = e.Container.FindControl("RadTimePicker1") as Telerik.Web.UI.RadTimePicker;
Telerik.Web.UI.RadDatePicker dateend = e.Container.FindControl("RadDatePicker2") as Telerik.Web.UI.RadDatePicker;
Telerik.Web.UI.RadTimePicker timeend = e.Container.FindControl("RadTimePicker2") as Telerik.Web.UI.RadTimePicker;
CheckBox alldaybox = e.Container.FindControl("CheckBoxAllDay") as CheckBox;
CheckBox BoxEnableRecurrenced = e.Container.FindControl("CheckBoxEnableRecurrenced") as CheckBox;
Panel panel1 = e.Container.FindControl("Panel1") as Panel;
Panel panelHourly = e.Container.FindControl("PanelHourly") as Panel;
Panel panelDays = e.Container.FindControl("PanelDDays") as Panel;
Panel panelWeekly = e.Container.FindControl("PanelWeekly") as Panel;
Panel panelMonthly = e.Container.FindControl("PanelMonthly") as Panel;
Panel panelYearly = e.Container.FindControl("PanelYearly") as Panel;
CheckBoxList checkboxlistWeek = e.Container.FindControl("CheckBoxListWeek") as CheckBoxList;
Telerik.WebControls.RadNumericTextBox radNumericTextBoxYearlyDay = e.Container.FindControl("RadNumericTextBoxYearlyDay") as Telerik.WebControls.RadNumericTextBox;
DropDownList dropDownListYearlyV = e.Container.FindControl("DropDownListYearlyV") as DropDownList;
DropDownList dropDownListYearlyE = e.Container.FindControl("DropDownListYearlyE") as DropDownList;
DropDownList dropDownListMRecurrenceDay = e.Container.FindControl("DropDownListMRecurrenceDay") as DropDownList;
DropDownList dropDownListYRecurrenceDay = e.Container.FindControl("dropDownListYRecurrenceDay") as DropDownList;
DropDownList dropDownListMDayOrdinal = e.Container.FindControl("DropDownListMDayOrdinal") as DropDownList;
DropDownList dropDownListYDayOrdinal = e.Container.FindControl("DropDownListYDayOrdinal") as DropDownList;
RadioButton radioButtonRepeat = e.Container.FindControl("RadioButtonRepeat") as RadioButton;
Telerik.WebControls.RadNumericTextBox radNumericTextBoxMaxRecurs = e.Container.FindControl("RadNumericTextBoxMaxRecurs") as Telerik.WebControls.RadNumericTextBox;
RadioButton radioButtonDateEnd = e.Container.FindControl("RadioButtonDateEnd") as RadioButton;
Telerik.Web.UI.RadDatePicker radDatePickerRangDate = e.Container.FindControl("RadDatePickerRangDate") as Telerik.Web.UI.RadDatePicker;
RadioButtonList radioButtonList1 = e.Container.FindControl("RadioButtonList1") as RadioButtonList;
Telerik.WebControls.RadNumericTextBox radNumericTextBoxHours = e.Container.FindControl("RadNumericTextBoxHours") as Telerik.WebControls.RadNumericTextBox;
RadioButton radioButtonDEveryDay = e.Container.FindControl("RadioButtonDEveryDay") as RadioButton;
Telerik.WebControls.RadNumericTextBox radNumericTextBoxDDaysCount = e.Container.FindControl("RadNumericTextBoxDDaysCount") as Telerik.WebControls.RadNumericTextBox;
RadioButton radioButtonDEveryWorkDay = e.Container.FindControl("RadioButtonDEveryWorkDay") as RadioButton;
CheckBoxList checkBoxListWeek = e.Container.FindControl("CheckBoxListWeek") as CheckBoxList;
Telerik.WebControls.RadNumericTextBox radNumericTextBoxWCounts = e.Container.FindControl("RadNumericTextBoxWCounts") as Telerik.WebControls.RadNumericTextBox;
RadioButton radioButtonMEveryA = e.Container.FindControl("RadioButtonMEveryA") as RadioButton;
Telerik.WebControls.RadNumericTextBox radNumericTextBoxMCountsA = e.Container.FindControl("RadNumericTextBoxMCountsA") as Telerik.WebControls.RadNumericTextBox;
RadioButton radioButtonMEveryE = e.Container.FindControl("RadioButtonMEveryE") as RadioButton;
Telerik.WebControls.RadNumericTextBox radNumericTextBoxMCountADay = e.Container.FindControl("RadNumericTextBoxMCountADay") as Telerik.WebControls.RadNumericTextBox;
Telerik.WebControls.RadNumericTextBox radNumericTextBoxMCountsE = e.Container.FindControl("RadNumericTextBoxMCountsE") as Telerik.WebControls.RadNumericTextBox;
RadioButton radioButtonYEvery = e.Container.FindControl("RadioButtonYEvery") as RadioButton;
RadioButton radioButtonYearlyOn = e.Container.FindControl("RadioButtonYearlyOn") as RadioButton;
string datestartstr = string.Empty;
string dateendstr = string.Empty;
if (datestart.SelectedDate != null)
{
datestartstr = ((System.DateTime)datestart.SelectedDate).ToString("MM/dd/yyyy") + " " + ((System.DateTime)timestart.SelectedDate).ToString("h:mm tt");
}
else
{
datestartstr = ((System.DateTime)datestart.SelectedDate).ToString("MM/dd/yyyy");
}
if (dateend.SelectedDate != null)
{
dateendstr = ((System.DateTime)dateend.SelectedDate).ToString("MM/dd/yyyy") + " " + ((System.DateTime)timeend.SelectedDate).ToString("h:mm tt");
}
else
{
dateendstr = ((System.DateTime)dateend.SelectedDate).ToString("MM/dd/yyyy");
}
if (BoxEnableRecurrenced != null && BoxEnableRecurrenced.Checked)
{
e.Container.Appointment.RecurrenceState = RecurrenceState.Occurence;
RecurrenceRange recurRange = new RecurrenceRange();
recurRange.Start = e.Container.Appointment.Start;
recurRange.EventDuration = e.Container.Appointment.End - e.Container.Appointment.Start;
if (radioButtonRepeat.Checked)
{
recurRange.MaxOccurences = (int)radNumericTextBoxMaxRecurs.Value;
}
if (radioButtonDateEnd.Checked)
{
recurRange.RecursUntil = (System.DateTime)radDatePickerRangDate.SelectedDate;
}
RecurrenceDay dayMask;
switch (radioButtonList1.SelectedValue)
{
case "H":
HourlyRecurrenceRule hourlyRule = new HourlyRecurrenceRule((int)radNumericTextBoxHours.Value, recurRange);
e.Container.Appointment.RecurrenceRule = hourlyRule.ToString();
break;
case "D":
DailyRecurrenceRule dailyRule = null;
if (radioButtonDEveryDay.Checked)
{
dailyRule = new DailyRecurrenceRule((int)radNumericTextBoxDDaysCount.Value, recurRange);
}
if (radioButtonDEveryWorkDay.Checked)
{
dailyRule = new DailyRecurrenceRule(RecurrenceDay.WeekDays, recurRange);
}
e.Container.Appointment.RecurrenceRule = dailyRule.ToString();
break;
case "W":
dayMask = RecurrenceDay.None;
for (int i = 0; i < checkBoxListWeek.Items.Count; i++)
{
if (checkBoxListWeek.Items[i].Selected)
{
switch (checkBoxListWeek.Items[i].Value)
{
case "Sunday":
dayMask = dayMask | RecurrenceDay.Sunday;
break;
case "Monday":
dayMask = dayMask | RecurrenceDay.Monday;
break;
case "Tuesday":
dayMask = dayMask | RecurrenceDay.Tuesday;
break;
case "Wednesday":
dayMask = dayMask | RecurrenceDay.Wednesday;
break;
case "Thursday":
dayMask = dayMask | RecurrenceDay.Thursday;
break;
case "Friday":
dayMask = dayMask | RecurrenceDay.Friday;
break;
case "Saturday":
dayMask = dayMask | RecurrenceDay.Saturday;
break;
}
}
}
WeeklyRecurrenceRule weeklyRule = new WeeklyRecurrenceRule((int)radNumericTextBoxWCounts.Value, dayMask, recurRange);
e.Container.Appointment.RecurrenceRule = weeklyRule.ToString();
break;
case "M":
MonthlyRecurrenceRule monthlyRule = null;
if (radioButtonMEveryA.Checked)
{
monthlyRule = new MonthlyRecurrenceRule((int)radNumericTextBoxMCountADay.Value, (int)radNumericTextBoxMCountsA.Value, recurRange);
}
if (radioButtonMEveryE.Checked)
{
dayMask = RecurrenceDay.None;
switch (dropDownListMRecurrenceDay.SelectedValue)
{
case "day":
dayMask = dayMask | RecurrenceDay.EveryDay;
break;
case "weekday":
dayMask = dayMask | RecurrenceDay.WeekDays;
break;
case "weekend day":
dayMask = dayMask | RecurrenceDay.WeekendDays;
break;
case "Sunday":
dayMask = dayMask | RecurrenceDay.Sunday;
break;
case "Monday":
dayMask = dayMask | RecurrenceDay.Monday;
break;
case "Tuesday":
dayMask = dayMask | RecurrenceDay.Tuesday;
break;
case "Wednesday":
dayMask = dayMask | RecurrenceDay.Wednesday;
break;
case "Thursday":
dayMask = dayMask | RecurrenceDay.Thursday;
break;
case "Friday":
dayMask = dayMask | RecurrenceDay.Friday;
break;
case "Saturday":
dayMask = dayMask | RecurrenceDay.Saturday;
break;
}
monthlyRule = new MonthlyRecurrenceRule(int.Parse(dropDownListMDayOrdinal.SelectedValue), dayMask, (int)radNumericTextBoxMCountsE.Value, recurRange);
}
e.Container.Appointment.RecurrenceRule = monthlyRule.ToString();
break;
case "Y":
YearlyRecurrenceRule yearlyRule = null;
if (radioButtonYEvery.Checked)
{
yearlyRule = new YearlyRecurrenceRule((RecurrenceMonth)int.Parse(dropDownListYearlyV.SelectedValue), (int)radNumericTextBoxYearlyDay.Value, recurRange);
}
if (radioButtonYearlyOn.Checked)
{
dayMask = RecurrenceDay.None;
switch (dropDownListYRecurrenceDay.SelectedValue)
{
case "day":
dayMask = dayMask | RecurrenceDay.EveryDay;
break;
case "weekday":
dayMask = dayMask | RecurrenceDay.WeekDays;
break;
case "weekend day":
dayMask = dayMask | RecurrenceDay.WeekendDays;
break;
case "Sunday":
dayMask = dayMask | RecurrenceDay.Sunday;
break;
case "Monday":
dayMask = dayMask | RecurrenceDay.Monday;
break;
case "Tuesday":
dayMask = dayMask | RecurrenceDay.Tuesday;
break;
case "Wednesday":
dayMask = dayMask | RecurrenceDay.Wednesday;
break;
case "Thursday":
dayMask = dayMask | RecurrenceDay.Thursday;
break;
case "Friday":
dayMask = dayMask | RecurrenceDay.Friday;
break;
case "Saturday":
dayMask = dayMask | RecurrenceDay.Saturday;
break;
}
yearlyRule = new YearlyRecurrenceRule(int.Parse(dropDownListYDayOrdinal.SelectedValue), (RecurrenceMonth)int.Parse(dropDownListYearlyE.SelectedValue), dayMask, recurRange);
}
e.Container.Appointment.RecurrenceRule = yearlyRule.ToString();
break;
}
}
else
{
e.Container.Appointment.RecurrenceState = RecurrenceState.NotRecurring;
}
if (Session["ContactsofScheduler"] != null)
{
//do Insert Contacts
}
e.Container.Appointment.ID = guidstr;
TextBox subjectBox = e.Container.FindControl("TextBoxTitle") as TextBox;
e.Container.Appointment.Subject = subjectBox.Text;
e.Container.Appointment.Start = Convert.ToDateTime(datestartstr);
e.Container.Appointment.End = Convert.ToDateTime(dateendstr);
//Set Desp
TextBox despBox = e.Container.FindControl("TextBoxDesp") as TextBox;
e.Container.Appointment.Attributes["DESP"] = despBox.Text;
//Set Empno
Assignment_ASP_EMPCombo empbomo = e.Container.FindControl("ASP_EMPCombo1") as Assignment_ASP_EMPCombo;
e.Container.Appointment.Attributes["EMP_NO"] = empbomo.getEmpNO();
//Set Room
DropDownList radComboBoxRoom = e.Container.FindControl("RadComboBoxRoom") as DropDownList;
e.Container.Appointment.Attributes["RESOURCE_ID"] = radComboBoxRoom.SelectedValue;
//set Remark
TextBox textBoxREMARK = e.Container.FindControl("TextBoxREMARK") as TextBox;
e.Container.Appointment.Attributes["REMARK"] = textBoxREMARK.Text;
}
}
Best regards
Please, view the External Edit in RadWindow example. I believe this is similar to what you want to achieve. Note that the UpdateAppointment() and InsertAppointment() methods are used. I didn't see those methods in your code. Could this be the cause of the problem?
| protected void SubmitButton_Click(object sender, EventArgs e) |
| { |
| DateTime aptStart = RadScheduler1.DisplayToUtc((DateTime)StartTime.SelectedDate); |
| DateTime aptEnd = RadScheduler1.DisplayToUtc((DateTime)EndTime.SelectedDate); |
| if (mode == WindowMode.Edit) |
| { |
| Appointment apt = GetEditedAppointment(); |
| apt.Subject = DescriptionText.Text; |
| apt.Start = aptStart; |
| apt.End = aptEnd; |
| RadScheduler1.UpdateAppointment(apt); |
| } |
| else |
| { |
| // Insert |
| Appointment apt = new Appointment(); |
| apt.Start = aptStart; |
| apt.End = aptEnd; |
| apt.Subject = DescriptionText.Text; |
| RadScheduler1.InsertAppointment(apt); |
| } |
| ScriptPlaceholder.Text = "GetRadWindow().Close();"; |
| } |
Best wishes,
Peter
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Actually, I am doing this following the Templates's example, I do not see that InsertAppointment() method be called, and I try to use this method and there are two records be inserted into the table. one has subject value and one has not. please help me again. Thanks.
Best Ragards.
The reason why you cannot insert Subject from code behind is because the appointment always expects a subject. The proper way to implement this is the following:
| <asp:TextBox ID="TextBoxTitle" runat="server" Text='<%# Bind("Subject") %>' Width="95%" TextMode="MultiLine"></asp:TextBox> |
This will make the code behind implementation obsolete, so you should remove it:
| TextBox subjectBox = e.Container.FindControl("TextBoxTitle") as TextBox; |
| e.Container.Appointment.Subject = subjectBox.Text; |
Let us know how it goes.
All the best,
Peter
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Thanks for your help. the problem has been solved.
Thanks again.