Solved

update a key field in a gridview

Posted on 2006-07-20
2
599 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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

728 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now