Contents of ButtonColumn and HyperLinkColumn

Ask a Question related to ASP.NET Data Grid Control, Design and Development.

  1. #1

    Default Contents of ButtonColumn and HyperLinkColumn

    Hi,

    Does anyone know how to get the contents OUT of a ButtonColumn item or a
    HyperLinkColumn Item in C#?
    For BoundColumns, it's extremely easy - e.items.cells[0].Text.
    This does not work with ButtonColumns or HyperLinkColumns.
    It should be SO simple, yet I've searched forever on google and have not been
    able to find what I'm looking for.
    Thanks in advance!

    -TR
    treilly via DotNetMonster.com Guest

  2. Similar Questions and Discussions

    1. HyperLinkColumn Color
      I changed a column in my Datagrid into a HyperLinkColumn and it turned the text blue. How do I make it brown again? Here's the line:...
    2. Listing contents of a directory folder to contents ofdirectory
      cfdirectory listing... Here is my problem... I am listing directorys and when each directory is listed I want to list the contents of that...
    3. buttoncolumn or hyperlinkcolumn
      Thanks Scott! I'm a new fan of your site. I started reading the Extensive look at the Datgrid article you wrote there. I also plan on buying your...
    4. buttonColumn
      Hi, Can someone please help? Currently I have in my datagrid a itemtemplate colume with a href that is working. However, instead of using...
    5. HyperlinkColumn
      Does anyone have know if it's possible to include multiple args in the NavigateURLFormatString property? The only examples I've seen are:...
  3. #2

    Default Re: Contents of ButtonColumn and HyperLinkColumn

    It depends where you get it. For example, in Datagrid_ItemCommand event,
    e.CommandName might be what you need for CommandButton. In
    DataGrid_ItemDataBound event, you need cast
    e.Item.Cells[col_index].Controls[0] (or e.item.FindControl("control_Name"))
    to specified type first, then get its Text property:



    LinkButton linkBtn = (LinkButton)e.Item.Cells[col_index].Controls[0];

    String name = linkBtn.Text;



    HTH






    "treilly via DotNetMonster.com" <u15154@uwe> wrote in message
    news:5655767fa073e@uwe...
    > Hi,
    >
    > Does anyone know how to get the contents OUT of a ButtonColumn item or a
    > HyperLinkColumn Item in C#?
    > For BoundColumns, it's extremely easy - e.items.cells[0].Text.
    > This does not work with ButtonColumns or HyperLinkColumns.
    > It should be SO simple, yet I've searched forever on google and have not
    > been
    > able to find what I'm looking for.
    > Thanks in advance!
    >
    > -TR

    Elton Wang Guest

  4. #3

    Default Re: Contents of ButtonColumn and HyperLinkColumn

    That worked! Thank you so much!


    --
    Message posted via DotNetMonster.com
    [url]http://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net-datagrid/200510/1[/url]
    treilly via DotNetMonster.com Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139