trying to access the row.databound

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

this fires from a gridview and this type of construction works ok in vb.net
but i keep getting:
CS0021: Cannot apply indexing with [] to an expression of type 'object' if i
use ]
and: CS0118: 'System.Web.UI.WebControls.GridViewRow.DataItem' is a
'property' but is used like a 'method' when i use ().

protected void gv_Portfolio_RowDB(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow) {
Response.Write(e.Row.DataItem("NEWPFXO"));
}
}

I'm sure it's a simple one.
 
i did it this way: (string)DataBinder.Eval(gvr.DataItem,"NEWPFXO")
I like your way better, Thank You!
--
thanks (as always)
some day i''m gona pay this forum back for all the help i''m getting
kes


Peter Bromberg said:
((DataRowView)e.Row.DataItem).Row["NEWPFXO"]

--
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com



WebBuilder451 said:
this fires from a gridview and this type of construction works ok in vb.net
but i keep getting:
CS0021: Cannot apply indexing with [] to an expression of type 'object' if i
use ]
and: CS0118: 'System.Web.UI.WebControls.GridViewRow.DataItem' is a
'property' but is used like a 'method' when i use ().

protected void gv_Portfolio_RowDB(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow) {
Response.Write(e.Row.DataItem("NEWPFXO"));
}
}

I'm sure it's a simple one.
 
Back
Top