Displaying Link Button Column Cell as Text

Results 1 to 2 of 2

Thread: Displaying Link Button Column Cell as Text

  1. #1
    Join Date
    Dec 1969

    Default Displaying Link Button Column Cell as Text

    Hello,<BR>I have a datagrid containing a link button column displaying an ID number from a database. If the ID the user selects contains additional information, I&#039;d like to display the results in another datagrid. If not, I&#039;d the ID number to only display as text, so the user will not be able to select it. Does anyone know how to do this or a good place to look? I&#039;m guessing I&#039;m going to have to use the datagrid&#039;s ItemDataBound event, but I just don&#039;t know how to enter text in a specific cell or how to reference a specific cell . Thanks!

  2. #2
    Join Date
    Dec 1969

    Default RE: Displaying Link Button Column Cell as Text

    I don&#039;t know necessarily the best way to do it, but a way to do it is to set-up a template column with a button and a label. The label is not visible at first – you can do that by default or by using the ItemDataBound event using a procedure I will explain below. When the button is pressed, you would hide the button and display the label.<BR><BR>To do that, you handle it in the ItemCommand Event for the grid, not the ItemDataBound. Use the function e.item.findcontrol(“YourLabelIdName”) and e.item.findcontrol(“YourButtonIdName”) to grab a reference to each control and set visibility and text to them.<BR><BR>If you choose to mess with the label or button during bind time as I mentioned before, you can do that using similar code during the ItemDataBound event.<BR><BR>Good luck.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts