473,398 Members | 2,404 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.

Binding Grid View to Objects??

Hi everyone,

I have now managed to write my own data layer and business layer
objects, mapped them out etc etc, and it all works fine.

The problem i am having is that my business object consist of other
business objects, example below

Object1
id
name
object2
object3collection

Object2 has properties and object3 is a collection of another object.
How in the grid view can i show the values of these fields??

I have tried object2.id, and object3collection.item(0).id, but it
doesnt work. i know there are objects within the collection because i
always add one, even if there isnt one (for testing)

Very grateful for any help. Cheers

Aug 17 '06 #1
1 979
If you want a datagrid that shows a bunch of Object1 types then your
ItemTemplate would be (these are all slightly different and assuming that
you're doing C# 2.0)....

<asp:label runat="server" id="id" Text="<%# (Container.DataItem as
Object1).Id.ToString() %>"/>
<asp:label runat="server" id="Name" Text="<%# (Container.DataItem as
Object1).name %>"/>
<asp:label runat="server" id="SomePropertry" Text="<%# (Container.DataItem
as Object1).Object2.PropertyName %>"/>
<asp:label runat="server" id="SomePropertry" Text="<%# (Container.DataItem
as Object1).Object3Collection[0].PropertyName %>"/>
<asp:DataGrid runat="server" id="Object3Grid" DataSource="<%#
(Container.DataItem as Object1).Object3Collection %>"/>

"Nemisis" wrote:
Hi everyone,

I have now managed to write my own data layer and business layer
objects, mapped them out etc etc, and it all works fine.

The problem i am having is that my business object consist of other
business objects, example below

Object1
id
name
object2
object3collection

Object2 has properties and object3 is a collection of another object.
How in the grid view can i show the values of these fields??

I have tried object2.id, and object3collection.item(0).id, but it
doesnt work. i know there are objects within the collection because i
always add one, even if there isnt one (for testing)

Very grateful for any help. Cheers

Aug 17 '06 #2

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

Similar topics

0
by: Ann Morris | last post by:
INTRODUCTION One of the most powerful aspects of .NET and Windows Forms is data binding. Data binding is the process of associating user interface (UI) elements with a data source to generate a...
9
by: Zlatko Matić | last post by:
I was reading about late binding, but I'm not completely sure what is to be done in order to adjust code to late binding... For example, I'm not sure if this is correct: early binding: Dim ws...
1
by: | last post by:
Hi I'm sorry for my english... I have a clas that contains a variable number of data stored in a dictionary. The key of the dictionary is a string that defines the name of the field. ( varA ...
0
by: Ian | last post by:
I have sub-classed the Page class in order to provide some base properties and methods that every page on my site will need access to. I would like to have these things show up in the Simple...
1
by: Demetri | last post by:
Someone posted the following back in June and I am now doing the same thing. I'll just paste what was asked and see if anyone can give us an answer: ...
1
by: Bill Sexton | last post by:
I have created a custom DataSourceControl to interface to a search engine. The DataSourceControl exposes multiple views of the same data. The first is the actual search results. The other views...
4
by: =?Utf-8?B?Si5NYXR0aGV3cw==?= | last post by:
Picture the cut down scenario... Say I have three datatables (Person, Address, Street) that are linked with datarelation objects using the PK/FK associations... Person -------- PersonId {PK}...
1
by: Monty M. | last post by:
Does anyone know how to perform two way data binding between a combo box and a listview. The listview is bound to a dataset table in code: Binding Bind = new Binding(); DataTable dt;...
0
by: furqanms | last post by:
Hello, I am new to WPF ,I am developing touch screen system using WPF. I am facing problem in Binding relative reference. Here is my code : <UserControl x:Class="uctlBrowser" ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
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.