473,473 Members | 1,988 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

trying to access the row.databound

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.

--
thanks (as always)
some day i''m gona pay this forum back for all the help i''m getting
kes
Aug 28 '07 #1
2 1804
((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" wrote:
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.

--
thanks (as always)
some day i''m gona pay this forum back for all the help i''m getting
kes
Aug 28 '07 #2
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 [C# MVP]" wrote:
((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" wrote:
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.

--
thanks (as always)
some day i''m gona pay this forum back for all the help i''m getting
kes
Aug 28 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Patrick Demets | last post by:
I have a fairly simple form with databound text boxes, but changes (or new records) are not recognized. The text boxes are successfully populated with data (from the database) and I can cycle...
5
by: Kat | last post by:
Hi, I'm trying to set up an asp.net page using flow layout so I'm putting all my controls into a table grid, etc. I use several radiobuttonlists and datagrids that are generated from datasource....
4
by: Frits van Soldt | last post by:
Hello, I hope somebody can help me with this! I have 2 listboxes in the edititemtemplate of a detailsview. In the databound event of the detailsview I would like to fill the listboxes...
5
by: clickon | last post by:
This is driving me nuts, it is such a simply thing to do but i cannot for the life of me work out how you are suposed to do it. I want to update the data in DropDownListB based on what is...
1
by: Owen Blacker | last post by:
I've spent loads of time Googling to try to work this one out and I'm sure it's something obvious. I get an InvalidOperationException reading "Databinding methods such as Eval(), XPath(), and...
3
by: Jeff | last post by:
hey asp.net 2.0 I want to programmatically populate (with data from the database) a label control in a FormView on a webpage. Is it a good idea to put my logic inside the DataBound event of...
1
by: Gerwin Berentschot | last post by:
Hi all, I am looking for a databound listbox control that can be as easily used as the listbox control that comes with Ms Access (with as less programming as possible). I would like this listbox...
9
by: Kyote | last post by:
I have a textbox that is databound to a table in an access database. The field only contains month/day/year but my databound textbox is also showing a time. Is there any way to prevent it from...
64
by: John | last post by:
Hello there, Im cursing my place of employment...and its taken me a month to realise it... The scenario: Ive just stepped into a role to migrate an access database to VB.Net. The access...
1
by: seanmatthewwalsh | last post by:
Hi I have a website that uses an Access 2003 database. I have controls on my pages that are bound to SqlDataSources that pull data from this database. In a couple of them, I need to use the...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.