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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

GridView question 1
nested gridview 1
How to in VB 2
DataItem is NULL, problem 1
csharp syntax help 6
How can I get the GridView object in the RowDataBound event? 1
GridView question 1
RowDataBound trouble 4

Back
Top