DataBinder.Eval and fields with a dot in the name

  • Thread starter =?iso-8859-1?Q?S=F8ren_Lund?=
  • Start date
?

=?iso-8859-1?Q?S=F8ren_Lund?=

Hello,

I am trying to bind a DataGrid with some data from a DataSet which
contains fields in the form "group.fieldname". I am certain that my
data source contains the field but I cannot get my head around which
syntax to use when specifying which field to bind to the DataGrid.

I have tried

<%# DataBinder.Eval( Container.DataItem, "Group.FieldName" ) %>

and

<%# DataBinder.Eval( Container.DataItem, "[Group.FieldName]" %> which
is just plain old wrong :)

Can any one help me out here?
 
A

Ashish M Bhonkiya

hi Søren Lund,

text='<%#DataBinder.Eval(Container.DataItem, "Desc")%>'

you need to give the name of the field.

HTH
Regards
Ashish M Bhonkiya
 
?

=?iso-8859-1?Q?S=F8ren_Lund?=

Swanand said:
is the datasource a custom collection or is Group.FieldName one of
your columns in the db?

The field is from a standard dataset which has been populated through a
custom oledb provider (a Commerce Server provider if that is any help
to you).
 
?

=?iso-8859-1?Q?S=F8ren_Lund?=

Ashish M Bhonkiya wrote:

Yes I know, the problem is that the databinder returns an error if I
specify that name with a dot in it. My fields are named
"blabla.theotherthing" which throws an exception at runtime, like this:

DataBinder.Eval: 'System.Data.DataRowView' does not contain a property
with the name GeneralInfo.

Notice ths dot at the end of the exception, the field is actually named
GeneralInfo.logon_name. It seems to me that the databinder stops
processing when it reaches the dot even though there's more of the name
left? Kinda weird.

Also I am able to bind the data to the DataGrid if I AutoGenerate the
columns of the DataGrid but that's really not what I am looking for.
text='<%#DataBinder.Eval(Container.DataItem, "Desc")%>'

you need to give the name of the field.
I am trying to bind a DataGrid with some data from a DataSet which
contains fields in the form "group.fieldname". I am certain that my
data source contains the field but I cannot get my head around which
syntax to use when specifying which field to bind to the DataGrid.

I have tried

<%# DataBinder.Eval( Container.DataItem, "Group.FieldName" ) %>

and

<%# DataBinder.Eval( Container.DataItem, "[Group.FieldName]" %>
which is just plain old wrong :)

Can any one help me out here?
 

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

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top