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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:12:08+00:00 2026-05-22T01:12:08+00:00

I have a fairly standard DataGrid. It contains a few BoundColumns. I’m overloading one

  • 0

I have a fairly standard DataGrid. It contains a few BoundColumns.
I’m overloading one of these columns to contain either text or a LinkButton depending on some characteristics of the bound item.

So.. in the ItemDataBound event for the Grid, I check a few things and add either a Label Control, or LinkButton Control to the proper Cell.

If I click on one of these LinkButtons, a postback occurs, but it does not call the method in the event handler of the button.

I have seen some people say that events will not work if you create controls AFTER the PreInit page event. Is that true? If so, there must be a way I can manually wire these up?

I have tried creating all of the buttons in PreInit and only adding them in ItemDataBound which unsurprisingly did not work.

I have heard others say the buttons and each parent control must have a unique ID. Is that true?

Rather than blindly swing away at this, I’d like to understand exactly why I can’t do this.

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-22T01:12:09+00:00Added an answer on May 22, 2026 at 1:12 am

    As far as I understand it, if you put a link button inside a DataGrid you need to use the RowCommand, i.e.

    <asp:LinkButton ID="btnUpdate" CommandName="Something" CommandArgument='<%# Bind("something") %>' runat="server">Update</asp:LinkButton>
    

    Then you need to bind the OnRowCommand event to a function in your DataGrid. This will pass the Command Argument that was given to link button and the name of the command in an Event Argument. You can use this to re-act appropriately to the event.

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

Sidebar

Related Questions

I have a fairly standard ASP.Net web application which is used via mobile safari
I have a fairly standard Java EE6 web application using JPA 2 with dependency
I have a question about forms. I have a fairly standard form that saves
I have what I think is a fairly standard setup, a ListBox backed by
I'm working with a standard post/comments system where one member writes a post and
I have a command that binds to the view model, is enabled, but doesn't
I have an interface that defines the behaviour of an object that does some
I've just read about MVC3's new CompareAttribute that you can apply to a model's
Update: 24 Mar 2011: Just wanted to add that I've had a look at

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.