Modify Hyperlinkfield text in Gridview

Posted by JohnG on Stack Overflow See other posts from Stack Overflow or by JohnG
Published on 2010-03-26T12:37:46Z Indexed on 2010/03/26 12:43 UTC
Read the original article Hit count: 275

Filed under:
|
|

I am stumped on this one. I want to modify the text in a Hyperlinkfield of Gridview after the data is bound to it. I found similar code to this on msdn and I can't get it to work.

    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        e.Row.Cells[2].Text = e.Row.Cells[2].Text + "random text";
    }

I also tried similar code in the Page_PreRender event with no luck. I have also tried calling DataBind() before this one line of code with no help. I always just get "random text" in the cell without the data from the DB. Thanks

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about c#