467,877 Members | 1,149 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,877 developers. It's quick & easy.

DataBinder.Eval and fields with a dot in the name

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?

--
Med venlig hilsen,
Søren Lund
http://www.publicvoid.dk
Nov 18 '05 #1
  • viewed: 2269
Share:
4 Replies
hi Søren Lund,

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

you need to give the name of the field.

HTH
Regards
Ashish M Bhonkiya
"Søren Lund" <mu****@hotmail.com> wrote in message
news:xn***************@news.microsoft.com...
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?

--
Med venlig hilsen,
Søren Lund
http://www.publicvoid.dk

Nov 18 '05 #2
is the datasource a custom collection or is Group.FieldName one of your
columns in the db?

--
Swanand Mokashi
Microsoft Certified Solution Developer (.NET)
Microsoft Certified Application Developer (.NET)
http://www.swanandmokashi.com/
http://www.swanandmokashi.com/HomePage/WebServices/
Home of the Stock Quotes, Quote of the day and Horoscope web services
"Søren Lund" <mu****@hotmail.com> wrote in message
news:xn***************@news.microsoft.com...
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?

--
Med venlig hilsen,
Søren Lund
http://www.publicvoid.dk

Nov 18 '05 #3
Swanand Mokashi wrote:
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).

--
Med venlig hilsen,
Søren Lund
http://www.publicvoid.dk
Nov 18 '05 #4
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?

--
Med venlig hilsen,
Søren Lund
http://www.publicvoid.dk
Nov 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Michelle Keys | last post: by
1 post views Thread by A Ratcliffe | last post: by
4 posts views Thread by Pierre Shirvan | last post: by
4 posts views Thread by CharlesA | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.