473,398 Members | 2,188 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

DataBinder.Eval for an object's property property... like Eval(Container.DataItem,"Version.Major")

Given databinding an array of System.Version types:

Given that "SomeObject" type has a Version property:

public class SomeObject
{
public Version Version { get; }
public string Description { get; }
}

and I want to bind a list of them to a datagrid.

DataGrid1.DataSource = someObjectList; // basically an array of "someobject"
DataGrid1.DataBind();

How does one utilize the DataBinder.Eval (and in asp.net v2.0, the Eval
method) to get to the SomeObject.Version.Major property?

(Assuming ALL that other stuff is Syntax proper, and so forth)

--
Eric Newton
eric.at.ensoft-software.com
www.ensoft-software.com
C#/ASP.net Solutions developer

Nov 19 '05 #1
3 2243
In your template:

<asp:Repeater ...>
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "Version") %> is the version<br/>
<%# DataBinder.Eval(Container.DataItem, "Description") %> is the description<br/>
</ItemTemplate>
</asp:Repeater>

Container.DataItem is the "row" you're databinding to. The "row" can be any
object, SomeObject in your case. DataBinder.Eval dynamicaly looks up on the
first parameter the propery specified by the secon parameter and returns
the string representation. this is used to fill in the Repeter's rendering.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Given databinding an array of System.Version types:

Given that "SomeObject" type has a Version property:

public class SomeObject
{
public Version Version { get; }
public string Description { get; }
}
and I want to bind a list of them to a datagrid.

DataGrid1.DataSource = someObjectList; // basically an array of
"someobject" DataGrid1.DataBind();

How does one utilize the DataBinder.Eval (and in asp.net v2.0, the
Eval method) to get to the SomeObject.Version.Major property?

(Assuming ALL that other stuff is Syntax proper, and so forth)


Nov 19 '05 #2
I was actually talking about the Version property's Major property...
because the following doesn't work:

<%# DataBinder.Eval(Container.DataItem, "Version.Major") %>

I'm trying to find out if there's a different delimiter (besides the
intuitive ".") to use to tell the Eval method to give me
SomeObject.Version.Major

--
Eric Newton
eric.at.ensoft-software.com
www.ensoft-software.com
C#/ASP.net Solutions developer

"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:36**********************@msnews.microsoft.com ...
In your template:

<asp:Repeater ...>
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "Version") %> is the version<br/>
<%# DataBinder.Eval(Container.DataItem, "Description") %> is the
description<br/>
</ItemTemplate>
</asp:Repeater>

Container.DataItem is the "row" you're databinding to. The "row" can be
any object, SomeObject in your case. DataBinder.Eval dynamicaly looks up
on the first parameter the propery specified by the secon parameter and
returns the string representation. this is used to fill in the Repeter's
rendering.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Given databinding an array of System.Version types:

Given that "SomeObject" type has a Version property:

public class SomeObject
{
public Version Version { get; }
public string Description { get; }
}
and I want to bind a list of them to a datagrid.

DataGrid1.DataSource = someObjectList; // basically an array of
"someobject" DataGrid1.DataBind();

How does one utilize the DataBinder.Eval (and in asp.net v2.0, the
Eval method) to get to the SomeObject.Version.Major property?

(Assuming ALL that other stuff is Syntax proper, and so forth)


Nov 19 '05 #3
I was actually talking about the Version property's Major property...
because the following doesn't work:

<%# DataBinder.Eval(Container.DataItem, "Version.Major") %>


As long as those are all public properties (fields don't work), then that
syntax should work fine.

-Brock
DevelopMentor
http://staff.develop.com/ballen

Nov 19 '05 #4

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

Similar topics

0
by: Arne Kösling | last post by:
Hi ! I am new to Web Services. Therefore I ve set up a PHP Installation on Windows (PHP 4.3.2 and Apache 1.3.29). I have tested PHP alone and then installed PEAR. Now I am stuck there (Before...
1
by: paolo.riba | last post by:
Hi! How I can know the "Country version" of SQL Server using VB.NET (perhaps with the SQLDMO)? I mean: if the SQL Server is in "English version" or in "Italian version" or ... Thank you so...
7
by: Bennett Haselton | last post by:
Is there any way to find a string representing an object's class, which will work in Internet Explorer 6? "typeof" doesn't work -- it returns "object" for all objects: x =...
3
by: Gary | last post by:
Hi, In the program below, C = A+B, and the aim is to delay the calculation of C until the user asks for C. The boolean mUTD (UpToDate) is used indicate when Calc() must be run to make the C =...
1
by: Vern DeHaven | last post by:
Hello all, Working on a W2K3 box with Framework version 1.1.4322 here. I've implemented a Web service in VB.NET by generating a server skeleton off the WSDL and overriding the abstract class. ...
2
by: Justin Drerup | last post by:
I'm tryng to return a custom object that contains a collection of MembershipUsers through a web service however I receive the following error when trying to return the object through a web method:...
3
by: jbeteta | last post by:
Hello, I have a problem declaring variables. I need to create an object oRpte as ReportClass on WebForm1.aspx and be able to use its value on WebForm2.aspx. For declaring the property oRpte()...
35
by: Chris | last post by:
Hi, I tried to create a class which must change the propety 'visible' of a <linktag in the masterpage into 'false' when the user is logged. But i get the error: "Object reference not set to an...
3
by: Lax | last post by:
Isn't it "technically" meaningless to call C a "row major language," since there are no such things as multidimensional arrays in C. In C you can define arrays of arrays, and the way that the...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.