By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,077 Members | 1,237 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,077 IT Pros & Developers. It's quick & easy.

DataBinder.Eval and fields with a dot in the name

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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.