Dynamic change text on Select button in GridView

    Date: 02/11/08 (Asp Dot Net)    Keywords: web

    I am trying to set the Text of a select button in a GridView with no success.
    Here is my code. I get the following error - 'System.Web.UI.WebControls.GridViewRowEventArgs' does not contain a definition for 'Item'
    What I want to do is set the Text of each Select button to = drv["Subject"].ToString()

    protected void MessagesGridView_RowDataBound(object sender, GridViewRowEventArgs e)
    {
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
    e.Row.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(this.MessagesGridView, "Select$" + e.Row.RowIndex);
    LinkButton SelectButton = (LinkButton)e.Row.Cells[7].Controls[0];

    DataRowView drv = (DataRowView)e.Item.DataItem;
    SelectButton.Text = drv["Subject"].ToString();
    }
    }

    Does anyone know how I do this ?

    Source: http://community.livejournal.com/aspdotnet/95815.html

« select checkbox or select row || Postback question »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home