Solved

update a key field in a gridview

Posted on 2006-07-20
2
604 Views
Last Modified: 2012-05-05
In ASP.NET 2.0 with C# I have a page with sqldatasource and a gridview.
the gridview datakeynames consists of 2 fields. I have a demand to update one of the key fields the second key.
I thought of including in the gridview another invisible field that will keep the old value of the second key
and in the update command I will point in the where clause to this field. but the problem is that
the GridViewUpdateEventArgs.oldvalues does not contain the key at all in its list because it is a key field.
How can I update a key field in a gridview?
Thankyou
Anat
0
Comment
Question by:ANAT2403
2 Comments
 
LVL 39

Accepted Solution

by:
Pratima Pharande earned 500 total points
ID: 17144225
See this link

http://www.velocityreviews.com/forums/t294481-get-value-of-a-cell-in-a-gridview.html


Using this you can use the invisible column(hidden)

This is a trick because gridview dosen't support hidden columns

hope this helps you :)
thanx
0
 

Author Comment

by:ANAT2403
ID: 17144730
Hi,
You link helped me a lot and I even improved it and made it more simple.
I declared in the gridview a field that is not hidden and only in the Page_Load I made it hidden.
Thankyou
Anat
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question