Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / DataGrid / August 2007

Tip: Looking for answers? Try searching our database.

Gridview - Pull value from one cell in one row

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
pvong - 05 Aug 2007 15:15 GMT
Hi, I'm a newbie and I'm looking for some help.  I'm programming in
VB.Net.

     I have a simple gridview and when the user hits the Edit link, the
gridview changes to edit mode.  I replaced the Textboxes with labels and I
turn off the Update command because I want to write my own update command.
I can not figure out how to pull the value from a cell in the row the user
hit Edit on.

     Example: User hits edit on row 10 and the value I want to pull in in
column 5 and is a Label with the ID of AnswerID.  How do I get that value.
This is what I've tried and it didn't work.

     Gridview.findcontrol("AnswerID").tostring

     Thanks!
pvong - 06 Aug 2007 04:24 GMT
someone answered this at another group

To get the content, use (VB.NET)
CType(Gridview.Rows(GridView.EditIndex).Cells(5).FindControl("AnswerID"),Label).Text
In C#:
((Label)Gridview.Rows(GridView.EditIndex).Cells(5).FindControl("AnswerID")).Text

>      Hi, I'm a newbie and I'm looking for some help.  I'm programming in
> VB.Net.
[quoted text clipped - 12 lines]
>
>      Thanks!

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.