Link to home
Start Free TrialLog in
Avatar of 5thcav
5thcavFlag for United States of America

asked on

EZ1 get datasource name of e.Item.Cells(i) in datagrid

having trouble setting a row to session by data source name of the cell.
just need to replace "DATASOURCE" in the section below to reflect 'i' as data sourcename

Thanks

Private Sub grdks_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles grdks.ItemCommand
        If e.Item.ItemType = ListItemType.Pager Or e.Item.ItemType = ListItemType.Header Then
            Exit Sub
        End If
            Dim i As Integer
            For i = 0 To grdks.Items.Count - 1
                Session(DATASOURCENAME) = e.Item.Cells(i).Text
            Next i
end sub
ASKER CERTIFIED SOLUTION
Avatar of irps20001
irps20001
Flag of India 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
Avatar of 5thcav

ASKER

Hi Rana

I thought about an array, i thought sessions would be just as good seeing im not going to have to loop through the data after i fill it,, so it seemed and array was an overkill,,, im guessing the sesion data would be less work on the server,..

ney my trouble was, i can t   replace the DATASOURCENAME on this statement > Session(DATASOURCENAME) with the actual name of the datasource.

so my loop will make:
Session(Item.Cells(i).????? ) = e.Item.Cells(i).Text

Session("ID") = e.Item.Cells(i).Text
Session("Fname") = e.Item.Cells(i).Text
Session("Lname") = e.Item.Cells(i).Text

thanks