Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6707115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:36:03+00:00 2026-05-26T07:36:03+00:00

I am using a GridView control which is databound to a List of objects

  • 0

I am using a GridView control which is databound to a List of objects returned from a utility method. The GridView control has one of the columns set as its DataKey. When a row is Selected, it fires the Selected event handler and I can use myGridView.SelectedDataKey.Value to get the value of the DataKey column for the selected row.

However, the event handler for when a row is Edited or Deleted does not seem to have a mechanism to get the DataKey value for the row in question. The event arg parameter for these event handlers contains the index of the row in the GridView but I’m specifically after the DataKey value.

Re-obtaining the List of objects via the utility method along with the index obtained from the event arg parameter is not an option because the List of objects may have changed.

Can anyone tell me how I can do this?

TIA

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:36:04+00:00Added an answer on May 26, 2026 at 7:36 am
     protected void gridQuestion_RowDeleting(object sender, GridViewDeleteEventArgs e)
     {
         int id = (int)grdQuestions.DataKeys[e.RowIndex].Value;      
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using an ASP.NET GridView control with a TemplateColumn which has a TextBox
I have standard .net 2.0 gridview control from which i want to get row
I am using vb.net code in which I am having a gridview control. Please
I have an ASP.NET GridView control with two asp:CommandField columns that are both using
I am using a accordion control which has nested gridviews within the content section
I'm using a CheckBoxList to define which columns are displayed in a GridView. I
I had gridview which on databound I need to hid Image control so I
Using asp.net 3.5 Gridview control, visual studio 2008. I have played with all the
I am using an ASP.NET GridView control, created dynamically with C# on a SharePoint
I am using the ASP.NET3.5 gridview control in a new project. My problem is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.