?
Solved

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

Posted on 2006-04-09
2
Medium Priority
?
264 Views
Last Modified: 2008-03-10
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
0
Comment
Question by:5thcav
2 Comments
 
LVL 7

Accepted Solution

by:
irps20001 earned 2000 total points
ID: 16414963
Hi
I understand this as you want to store a particular row data into session. If iam correct, why dont you use an arraylist and store it in a session later if u really want.
For ex:
[CODE]
Private dataSourceArrayList As New ArrayList
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
            dataSourceArrayList.Add(e.Item.Cells(i).Text)
            'Session(DATASOURCENAME) = e.Item.Cells(i).Text
        Next i
    End Sub
[/CODE]
Further if you want to do some operations with the data that is captured into arraylist, can be used as per your requirement.

This is an alternate solution for your problem, There could be many solutions. Do let me know if you are looking for something more so that i will try to give alternate solutions.

HTH
Happy Programming
Rana
0
 
LVL 7

Author Comment

by:5thcav
ID: 16416556
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
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month15 days, 23 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question