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: https://aspdotnet.livejournal.com/95815.html