Link to home
Start Free TrialLog in
Avatar of AceAdmin
AceAdmin

asked on

how do i get a value from the data item in my datagrid

I am trying to get at information that was passed into my datagrid via a datareader.
When the datagrid is set into edit mode and a button is pressed within my datagrid

Private Sub departmentsGrid_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles departmentsGrid.ItemCommand
        Select Case e.CommandName
            Case "btnUploadFile_Click"
       
                Dim departmentID As String = e.Item.DataItem("DepartmentID").ToString

            End Select
    End Sub
End Class

This says

 System.NullReferenceException: Object variable or With block variable not set.

Im not sure how to get at information in my datagrid.

i have also tried

DataBinder.Eval(Container.DataItem, "ImagePath")

Same thing happens


ASKER CERTIFIED SOLUTION
Avatar of Alexandre Simões
Alexandre Simões
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial