This is a migrated thread and some comments may be shown as answers.

Fidcontrol usercontrol in ItemCommand

0 Answers 91 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 21 Jul 2011, 04:01 PM

I have a stand alone form used for time entry.  i display entries in a radgrid.  intead of using the pop up edit form, I just want to prefill some values in my user control to do the edit.   I cannot seem to find the control with this code.  i have definitely verified the names are correct.  It says  u  is nothing then errors when I try to find a drop down list.

Protected Sub rgTimeslips_ItemCommand(ByVal source As Object, ByVal e As GridCommandEventArgs) Handles rgTimeslips.ItemCommand
 
 
     LogID = e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("KeyID")
     DocID = e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("SONumber")
     Label7.Text = LogID & "," & DocID
 
 
     pnlForm.Visible = True
     pnlLogGrid.Visible = False
 
      
     'set values of Time Entry user control
     Dim u As UserControl = TryCast(FindControl("TimeEntry2"), UserControl)
     Dim ddlso As DropDownList = TryCast(u.FindControl("ddlSO"), DropDownList)
     ddlso.SelectedValue = DocID
     Dim SOLogKeyID As HiddenField = TryCast(u.FindControl("SOLogKeyID"), HiddenField)
     Dim TimeSlipKeyID As HiddenField = TryCast(u.FindControl("TimeSlipKeyID"), HiddenField)
     If DocID = 0 Then
         SOLogKeyID.Value = "0"
         TimeSlipKeyID.Value = LogID
     Else
         SOLogKeyID.Value = LogID
         TimeSlipKeyID.Value = "0"
     End If
     ddlso.Enabled = False
 
 
 
 End Sub

No answers yet. Maybe you can help?

Tags
Grid
Asked by
David
Top achievements
Rank 1
Share this question
or