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 7698227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:11:36+00:00 2026-05-31T22:11:36+00:00

On GridView1 RowDataBound how can I get something like this : SELECT * FROM

  • 0

On GridView1 RowDataBound how can I get something like this :

SELECT * FROM tableName WHERE Column AND DataTableID=RowEditIndex.

I’m trying to get the value of a cell from dataTable of the current editing row . so he needs to get the value from a certain cell of datTable of the current editing row of the gridview.

I need the correct sql statment and I need it in rowDataBound gridview cuz I have another code there.

thanks

  • 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-31T22:11:37+00:00Added an answer on May 31, 2026 at 10:11 pm

    You can achieve this using data keys on the GridView, like this:

    <asp:GridView ID="GridView1" runat="server" DataKeyNames="SomeID, SomeOtherColumn" OnRowDataBound="GridView1_RowDataBound" ...>
    

    And in the code-behind:

    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        int someID = (int)GridView1.DataKeys[e.Row.RowIndex]["SomeOtherColumn"];
    
        //do whatever you need to do with the value
    }
    

    EDIT: Here’s an example of how you can access a data key in the RowUpdating event:

    protected void TaskGridView_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        var someValue = GridView1.DataKeys[e.RowIndex]["SomeOtherColumn"].ToString();
    }
    

    You can also access the value through the DataItem property in the RowDataBound event:

    int someID = (int)DataBinder.Eval(e.Row.DataItem, "SomeID");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I get the value of a gridview cell? I have been trying
how would i change the value IBM to something arbitrary like Cisco in one
in asp.net we can handle the RowDataBound event of the GridView control. this event
I have GridView which I can select a row. I then have a button
Trying to pop up an IFrame Shadowbox with Jquery from an asp:gridview datarow. I
In C# when I programmatically need to get a specific control from a GridView
Before you say, yeah this question can be duplicate; https://stackoverflow.com/questions/2912890/gridview-freeze-pane-solutions How to freeze GridView
I'm unexperienced with Ajax. I'm using a webgrid that executes: javascript:__doPostBack('GridView1','Select$1') when a row
protected void GridView1_DataBound(object sender, EventArgs e) { GridView1.Columns[0].ItemStyle.Width = 400; <asp:GridView ID=GridView1 runat=server DataSourceID=ObjectDataSource1
I am using C#.net I want to add custom edit/delete buttons to my GridView1

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.