Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Gridview - Pull value from one cell in one row

Reply
Thread Tools

Gridview - Pull value from one cell in one row

 
 
pvong
Guest
Posts: n/a
 
      08-05-2007
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!





 
Reply With Quote
 
 
 
 
pvong
Guest
Posts: n/a
 
      08-06-2007
someone answered this at another group

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



"pvong" <phillip*at*yahoo*dot*com> wrote in message
news:%(E-Mail Removed)...
> 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!
>
>
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Gridview - Pull value from one cell in one row pvong ASP .Net 4 08-05-2007 06:47 PM
Gridview row databound event - can't get past the 1st row of gridview maurban@gmail.com ASP .Net 5 10-13-2006 09:37 PM
weak pull up and pull down krithiga81@yahoo.com VHDL 2 06-28-2006 02:18 PM
GridView nested in DataList - refreshing corresponding DataList row after updating GridView row H5N1 ASP .Net 0 04-26-2006 11:41 PM
I need to have a tooltip appear over a cell showing data from another cell in the same row. Thomasa Gregg ASP .Net Datagrid Control 1 06-09-2004 08:04 PM



Advertisments