Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieving data from a cell in GridView

Status
Not open for further replies.

dembyg

Programmer
Oct 20, 2001
58
US
Hello all, I hope someone can assist me with my problem. I have a gridview and I am trying to store data from a particular cell into a session variable... I tried several methods and none seem to work... would anyone happen to have a suggestion how I could accomplish my task.. Thanks
 
I would like to get the contents of the cell after loading the form. I tried using gridview.findcontrol and gridview.columns().tostring. none of these options work.
 
I would like to get the contents of the cell after loading the form
What do you mean "after loading the form"? On page load, on a button click, on data binding?


____________________________________________________________
Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]

Need help finding an answer? Try the Search Facility or read FAQ222-2244.
 
In that case, you'd have to loop through each row (unless you know which row you wanted) and have a look at the cell text e.g.
Code:
        For Each gr As GridViewRow In GridView1.Rows
            If gr.Cells(0).Text = "mytext" Then Session.Add("mytext", gr.Cells(0).Text)
        Next
I'd have thought it would make more sense to do it on the binding event though.


____________________________________________________________
Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]

Need help finding an answer? Try the Search Facility or read FAQ222-2244.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top