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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:50:12+00:00 2026-05-10T23:50:12+00:00

I currently have a gridview that has an asp:ButtonField as one of the columns.

  • 0

I currently have a gridview that has an asp:ButtonField as one of the columns. The event handler for the command extracts the row id of the gridview from the command argument and uses that to perform some logic. I now need to switch to using a template field for this column, and want to do something like this:

<asp:TemplateField HeaderText='Action'>     <ItemStyle HorizontalAlign='Center' />         <ItemTemplate>             <asp:LinkButton CommandName='myaction' CommandArgument='<%#Eval('id')%>' Text='do action' runat='server'/>         </ItemTemplate>  </asp:TemplateField> 

My problem is with the CommandArgument attribute – I don’t know how to get it to be the row id from the GridView. Eval(‘id’) doesn’t work – does anyone know what the name of the row id property is? Or a better way to do this?

  • 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. 2026-05-10T23:50:12+00:00Added an answer on May 10, 2026 at 11:50 pm

    Check out this document on Microsoft’s website.

    http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowcommand.aspx

    You don’t need to bind the row id. The command argument is used for event arguments as opposed to row arguments… if that makes sense.

    I guess what I’m trying to say is the row id is implicit. When you access the event CommandArgs it should be for something specific to the event you’re trying to raise.

    i.e. If you wanted to page, you’d have ‘next’, ‘prev’, ‘first’, ‘last’ or a page number in the CommandArgument.

    Say you have a ‘Delete’ Button or ImageButton. It’s clicked by the user; the delete event is received on the postback and bubbled up from the row to the grid with the whole row object passed as an argument. The grid then deletes the row as if it were a single control in a control collection – because that’s what it is, the table is a collection of table rows.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have an asp:GridView that displays a few BoundFields and then one asp:TemplateField
I currently have an ASP.NET GridView that displays a few columns to the user
I have an ASP.NET Panel that has a gridview inside of it. Below is
I have an interesting ASP/VB.NET problem. I have a gridview where each row has
I have a gridview control in my c# program which currently has 12 columns
I have an ASP .NET GridView with Paging. One column in it has a
I have a gridview that has a template field containing a checkbox as one
I'm currently building a Gridview that has expandable rows. Each row contains a dynamically
I currently have a control that called MyGridview that inherits Gridview. It has a
I have a fairly standard ASP.NET GridView that displays 2 columns that have a

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.