Solved

update a key field in a gridview

Posted on 2006-07-20
2
603 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

856 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