When using a RadTimePicker in a RadGrid (in a EditItemTemplateColumn), I'm getting Nothing for the RadTimePicker.SelectedTime object when updating.
Thanks!
Here is my RadGrid:
<telerik:RadGrid runat=
"server"
ID=
"grdScheduleBook"
AllowSorting=
"True"
AllowPaging=
"True"
PageSize=
"15"
AutoGenerateColumns=
"False"
OnNeedDataSource=
"grdScheduleBook_NeedDataSource"
RenderMode=
"Lightweight"
HeaderStyle-Font-Size=
"X-Small"
ItemStyle-Font-Size=
"X-Small"
Height=
"800px"
>
<MasterTableView EditMode=
"InPlace"
>
<Columns>
<telerik:GridTemplateColumn FilterControlAltText=
"Filter TemplateColumn column"
HeaderText=
"Pick Time"
UniqueName=
"PickTime"
HeaderStyle-Width=
"100px"
>
<EditItemTemplate>
<telerik:RadTimePicker ID=
"RadTimePicker1"
runat=
"server"
Skin=
"Default"
Width=
"88px"
>
</telerik:RadTimePicker>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID=
"Label1"
runat=
"server"
></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridEditCommandColumn>
</telerik:GridEditCommandColumn>
<telerik:GridBoundColumn UniqueName=
"Group"
DataField=
"Group"
HeaderText=
"Group"
ReadOnly
=
"True"
>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName=
"Payroll"
DataField=
"Payroll #"
HeaderText=
"Payroll #"
ReadOnly
=
"True"
>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName=
"LastName"
DataField=
"Last Name"
HeaderText=
"Last Name"
ReadOnly
=
"True"
>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName=
"FirstName"
DataField=
"First Name"
HeaderText=
"First Name"
ReadOnly
=
"True"
>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName=
"MI"
DataField=
"MI"
HeaderText=
"MI"
ReadOnly
=
"True"
>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName=
"SeniorDate"
DataField=
"Senior Date"
HeaderText=
"Senior Date"
ReadOnly
=
"True"
>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName=
"Sequence"
DataField=
"Seq"
HeaderText=
"Sequence"
ReadOnly
=
"True"
>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName=
"DeptLoc"
DataField=
"Dept #/ Location"
HeaderText=
"Dept/Location"
ReadOnly
=
"True"
>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName=
"JobCode"
DataField=
"Job Code"
HeaderText=
"Job Code"
ReadOnly
=
"True"
>
</telerik:GridBoundColumn>
</Columns>
<EditFormSettings>
<EditColumn UniqueName=
"EditCommandColumn1"
FilterControlAltText=
"Filter EditCommandColumn1 column"
></EditColumn>
</EditFormSettings>
</MasterTableView>
<GroupingSettings CollapseAllTooltip=
"Collapse all groups"
></GroupingSettings>
<ClientSettings AllowColumnsReorder=
"True"
Resizing-AllowColumnResize=
"true"
ReorderColumnsOnClient=
"True"
>
<Selecting AllowRowSelect=
"True"
/>
<Scrolling AllowScroll=
"True"
UseStaticHeaders=
"True"
/>
<ClientEvents OnBatchEditOpening=
"OnBatchEditOpening"
/>
<Resizing AllowColumnResize=
"True"
></Resizing>
</ClientSettings>
<HeaderStyle Font-Size=
"Small"
Font-Bold=
"True"
></HeaderStyle>
<ItemStyle Font-Size=
"Small"
></ItemStyle>
<FilterMenu RenderMode=
"Lightweight"
></FilterMenu>
<HeaderContextMenu RenderMode=
"Lightweight"
></HeaderContextMenu>
</telerik:RadGrid>
RadGrid_UpdateCommand:
Protected
Sub
grdScheduleBook_UpdateCommand(sender
As
Object
, e
As
GridCommandEventArgs)
Handles
grdScheduleBook.UpdateCommand
Dim
dataItem
As
GridEditableItem = TryCast(e.Item, GridEditableItem)
Dim
timePicker
As
RadTimePicker =
CType
(e.Item.FindControl(
"RadTimePicker1"
), RadTimePicker)
Dim
time
As
String
= timePicker.SelectedTime.ToString()
Dim
row
As
DataRowView = dataItem.DataItem
Dim
sql
As
String
Dim
payroll
As
String
= row.Row.ItemArray(1)
Dim
pickTime
As
String
= Format(time.ToString(),
"Short Time"
)
'...(sql command here)...
End
Sub