DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Sun, 5 Aug 2007 10:17:35 -0400,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    pvong phillip*at*yahoo*dot*com
          2    Riki
                 3    pvong phillip*at*yahoo*dot*com
                        4    Riki
                        5    pvong phillip*at*yahoo*dot*com


Gridview - Pull value from one cell in one row   
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!
Date:Sun, 5 Aug 2007 10:17:35 -0400   Author:  

Re: Gridview - Pull value from one cell in one row   
pvong wrote:

> 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


Gridview.Rows(GridView.EditIndex).Cells(5).FindControl("AnswerID").ToString()

Note that column 5 is the sixth column here (starts from 0).

-- 

Riki
Date:Sun, 5 Aug 2007 17:45:15 +0200   Author:  

Re: Gridview - Pull value from one cell in one row   
Thanks for replying.  To test this, I created another label (Results) 
outside of the gridview to show the value to make sure it works.  When I do 
this,  Results shows this error message.

System.Web.UI.WebControls.Label


"Riki"  wrote in message 
news:OBvQhe31HHA.5980@TK2MSFTNGP04.phx.gbl...

> pvong wrote:
>> 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
>
> Gridview.Rows(GridView.EditIndex).Cells(5).FindControl("AnswerID").ToString()
>
> Note that column 5 is the sixth column here (starts from 0).
>
> -- 
>
> Riki
> 
Date:Sun, 5 Aug 2007 12:46:04 -0400   Author:  

Re: Gridview - Pull value from one cell in one row   
pvong wrote:

> Thanks for replying.  To test this, I created another label (Results)
> outside of the gridview to show the value to make sure it works. When I do 
> this,  Results shows this error message.
>
> System.Web.UI.WebControls.Label


Gridview.Rows(GridView.EditIndex).Cells(5).FindControl("AnswerID").ToString()
produces the name of the control.

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

-- 

Riki
Date:Sun, 5 Aug 2007 18:59:58 +0200   Author:  

Re: Gridview - Pull value from one cell in one row   
Perfect!  Thanks!
"Riki"  wrote in message 
news:eyNtQI41HHA.5772@TK2MSFTNGP02.phx.gbl...

> pvong wrote:
>> Thanks for replying.  To test this, I created another label (Results)
>> outside of the gridview to show the value to make sure it works. When I 
>> do this,  Results shows this error message.
>>
>> System.Web.UI.WebControls.Label
>
> Gridview.Rows(GridView.EditIndex).Cells(5).FindControl("AnswerID").ToString()
> produces the name of the control.
>
> 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
>
> -- 
>
> Riki
> 
Date:Sun, 5 Aug 2007 14:47:02 -0400   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us