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

  • SEARCH
  • Home
  • 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 6870553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:41:51+00:00 2026-05-27T03:41:51+00:00

I currently have a LinkButton in the ItemTemplate of a ListView. Each button in

  • 0

I currently have a LinkButton in the ItemTemplate of a ListView. Each button in the ListView should call the same click event handler. However, in the handler I need to know which button was clicked. Is this possible?

<asp:ListView runat="server" ID="lvKeyGroup">
    <LayoutTemplate>
        <table>
            <asp:Placeholder runat="server" ID="itemPlaceholder" />
        </table>
    </LayoutTemplate>
    <ItemTemplate>
        <tr>
            <td>[<asp:LinkButton runat="server" Text="Remove" OnClick="lbRemoveAuthGroup_Click" />]</td>
            <td><%# Eval("AuthorizationGroup") %></td>
        </tr>
    </ItemTemplate>
</asp:ListView>
  • 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-27T03:41:52+00:00Added an answer on May 27, 2026 at 3:41 am

    Add CommandName property to each LinkButton and handle ListView’s ItemCommand event.

    Also you need to set ListView’s DataKeys property to your datasource object unique identifier name. The you can get selected row datakey:

    void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        // in assumption that your data item's unique identifier type is Int32
        var dataKey = (int)ListView1.DataKeys[e.Item.DataItemIndex].Value; 
    
        switch(e.CommandName)
        {
            case "Remove":
                // your code here
                break;
        }
    }
    

    Follow this link for ListView control overview: http://msdn.microsoft.com/en-us/library/bb398790.aspx

    Also, watch this video: http://www.pluralsight-training.net/microsoft/players/PSODPlayer?author=dan-wahlin&name=webforms-03&mode=live&clip=0&course=aspdotnet-webforms4-intro

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

Sidebar

Related Questions

Currently have password protection on my main and sub directories, however I'd like to
I am using RadGrid And I have LinkButton in its ItemTemplate. Onclick of this
i have a repeater than creates a table: <itemtemplate> <tr id=theTableRow runat=server> <td> <asp:LinkButton
Currently I have a small form that uses a asp:linkbutton to submit and send
I have an LinkButton control which I need to add a c# method to.
I have this method that I'm currently putting in each page I make, I
I am using VS2005. Currently I have a delete linkButton in my gridview, and
I have an asp:LinkButton which require following - - call jQuery to open link
Currently have a custom Form Element View: class Apply_View_Helper_JQueryUiFormRadio extends Zend_View_Helper_FormElement My form is
I currently have this script : function addConsultant() { var sheet_staffing = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(Staffing); var

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.