I have a couple of timepickers in a repeater item template:
When the checkbox next to the day of the week is checked, I want to show the timepicker (or the row they are in). This works fine for showing/hiding the row but the timepicker will not show the available times. I assume this has to do with how the page is seeign or not seeing the controls as they are set visible=true; or visible=false; (that is why I tried style=display:none)
Does anyone know how I can set the visibililty and still keep the timepickers functioning correctly?
Thanks
-Brent
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="XmlDataSource1"> |
<HeaderTemplate> |
<table> |
</HeaderTemplate> |
<ItemTemplate> |
<tr> |
<th colspan="2"><asp:Label ID="lblDayOfWeek" runat="server" text='<%# DataBinder.Eval(Container.DataItem,"Value") %>' /><asp:CheckBox ID="chkDayOfWeek" runat="server" OnCheckedChanged="DayOfWeek_Changed" AutoPostBack="true" /></th> |
</tr> |
<tr id="trRepeaterTimes" runat="server"> |
<td>Start Time:<telerik:RadTimePicker ID="RadTimePicker1" runat="server" Skin="Vista" TimeView-Interval="0:30" TimeView-Columns="6" /></td> |
<td>End Time:<telerik:RadTimePicker ID="RadTimePicker2" runat="server" Skin="Vista" TimeView-Interval="0:30" TimeView-Columns="6" /></td> |
</tr> |
</ItemTemplate> |
<FooterTemplate> |
</table> |
</FooterTemplate> |
</asp:Repeater> |
When the checkbox next to the day of the week is checked, I want to show the timepicker (or the row they are in). This works fine for showing/hiding the row but the timepicker will not show the available times. I assume this has to do with how the page is seeign or not seeing the controls as they are set visible=true; or visible=false; (that is why I tried style=display:none)
protected void DayOfWeek_Changed(object sender, EventArgs e) |
{ |
foreach (RepeaterItem dataItem in Repeater1.Items) |
{ |
CheckBox chk = (CheckBox)dataItem.FindControl("chkDayOfWeek"); |
RadTimePicker rtp1 = (RadTimePicker)dataItem.FindControl("RadTimePicker1"); |
RadTimePicker rtp2 = (RadTimePicker)dataItem.FindControl("RadTimePicker2"); |
HtmlTableRow tr = (HtmlTableRow)dataItem.FindControl("trRepeaterTimes"); |
if (chk.Checked) |
{ |
tr.Attributes.Add("style", "display:normal;"); |
rtp1.Visible = true; |
rtp2.Visible = true; |
RadAjaxManager1.AjaxSettings.AddAjaxSetting(rtp1, rtp1); |
} |
else |
{ |
tr.Attributes.Add("style", "display:none;"); |
rtp2.Visible = false; |
rtp1.Visible = false; |
} |
} |
} |
Does anyone know how I can set the visibililty and still keep the timepickers functioning correctly?
Thanks
-Brent