|
-
Mar 13th, 2010, 09:19 AM
#1
Thread Starter
New Member
[RESOLVED] GridView - How to refer to the row that is updating
Hi,
I'm facing the following issue:
I have a gridview that allows updating. I only want to show the relevant fields to the user. As a result I hide the ID field of the records. But I need this value as a parameter for my update command.
Apparently the value is always passed as 0 when the field is set invisible. When the field is set visible, the right value is passed.
I know it is possible to refer to a selected row and its controls, to get their values, even for invisible fields. This is what I want to do when the row is updating, in order to get the ID value of the label control which holds the ID value.
How do I refer to the row that is updating? I experienced that the row is not considered 'selected', so the SelectedRow property of the gridview does not do the trick.
Tnx
-
Mar 13th, 2010, 09:28 AM
#2
Re: GridView - How to refer to the row that is updating
Hey,
Can you show the code that you are using? Both the markup and the server side code?
Have you set the DataKeyNames property of the GridView?
Gary
-
Mar 13th, 2010, 09:32 AM
#3
Hyperactive Member
Re: GridView - How to refer to the row that is updating
Try this one...
it also contains the code 4 downloading...
hope that helps...@
-
Mar 13th, 2010, 10:02 AM
#4
Thread Starter
New Member
Re: GridView - How to refer to the row that is updating
 Originally Posted by dnanetwork
Great... exactly what I was looking for...
C# Code:
Label s_lblID = (Label)GridView1.Rows[e.RowIndex].FindControl("lblID");
Now I can get the value from s_lblID.text
It was e.RowIndex I needed... so simple... 
Tnx
Last edited by mikedp; Mar 13th, 2010 at 10:05 AM.
-
Mar 13th, 2010, 10:11 AM
#5
Hyperactive Member
Re: [RESOLVED] GridView - How to refer to the row that is updating
you are welcome....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|