Thursday, February 21, 2008

CS1955: Non-invocable member 'System.Web.UI.WebControls.TableRow.Cells' cannot be used like a method.

Hmm...
Browse thru this sample...


protected void GridView1_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
{
if ((e.Row.RowType == DataControlRowType.DataRow)) {
((Button)e.Row.FindControl("btnSelect")).Attributes.Add("onclick", "javascript:GetRowValue('" + e.Row.Cells(1).Text + "')");

}
}


The error :-
CS1955: Non-invocable member 'System.Web.UI.WebControls.TableRow.Cells' cannot be used like a method.

but got crazy CS1955 error at "Cells(1)" (from the code attached)
doing short msdn diggg.. and what I get...

Compiler Error CS1955

Error Message
Non-invocable member 'name' cannot be used like a method.

Only methods and delegates can be invoked. This error is generated when you try to use empty parentheses with something other than a method or delegate.
To correct this error
-->>Remove the parentheses from the expression.


Got any simpler way? (hehehe)

1 comments:

errazudin.ishak said...

dude..
fix yo code to this..

e.Row.Cells[1].Text