hiding radDatePicker in edit mode
I want to programmatically hide my raddatepicker when in edit mode. This is what I have so far and I think I am close, but I get an error. Any suggestions....?
Protected Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As Telerik.WebControls.GridCommandEventArgs) Handles RadGrid1.ItemCommand
If e.CommandName = "Edit" Then
For Each item As GridDataItem In RadGrid1.MasterTableView.Items
Dim txtBox As RadDatePicker = DirectCast(item("Metricmonth").FindControl("txtEdit2"), RadDatePicker)
txtBox.Visible =
False
Next
End If
Hi Aret,
When the edit command is fired the edit form is not created yet, so it is too early to look for its controls there. You would better handle the ItemCreated or ItemDataBound event for that purpose. Check the below article:
http://www.telerik.com/help/aspnet-ajax/grid-distinguish-edit-insert-mode-on-itemcreated-itemdatabound.html
Regards,
Iana Tsolova
the Telerik team