473,473 Members | 1,918 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to access a named table from a repeater control with the eval method

Hi,
In my DataSet, which is bound to a repeater, I have two tables: item
and child:
ds = new DataSet();
itemadapter.Fill(ds, "item");
childadapter.Fill(ds, "child");

How do I access e.g. the item table and the colums in it from my
itemtemplate of the repeater control?

I'v tried the following code which doesn't work:
<asp:Repeater ID="Repeater1" Runat="server" >
<ItemTemplate>
<td>
<asp:Label Runat="server" Text='<%#
DataBinder.Eval(Container.DataItem,
"Tables[item].DefaultView.[0].Price") %>' ></asp:Label>
</ItemTemplate>
</asp:Repeater>

I get an exception there: "DataBinding: 'System.Data.DataRowView' does
not contain a property with the name 'Tables'."

Can anyone tell how I could get the information from that "item"
table?

Thanx

Georg
Nov 18 '05 #1
1 1240
Hi Geog:

One way to do this would be to make the DataSet a protected field in
your code behind (the base class).

Then you will be able to do something like:

<%# DataBinder.Eval(myDataSet, "Tables[1].DefaultView[0][0]") %>

The trick will be in knowing what row you need to access, but perhaps
you already have that setup to work.

HTH,

--
Scott
http://www.OdeToCode.com

On 23 Jun 2004 00:54:54 -0700, ge********@gmx.de (Georg Mayer) wrote:
Hi,
In my DataSet, which is bound to a repeater, I have two tables: item
and child:
ds = new DataSet();
itemadapter.Fill(ds, "item");
childadapter.Fill(ds, "child");

How do I access e.g. the item table and the colums in it from my
itemtemplate of the repeater control?

I'v tried the following code which doesn't work:
<asp:Repeater ID="Repeater1" Runat="server" >
<ItemTemplate>
<td>
<asp:Label Runat="server" Text='<%#
DataBinder.Eval(Container.DataItem,
"Tables[item].DefaultView.[0].Price") %>' ></asp:Label>
</ItemTemplate>
</asp:Repeater>

I get an exception there: "DataBinding: 'System.Data.DataRowView' does
not contain a property with the name 'Tables'."

Can anyone tell how I could get the information from that "item"
table?

Thanx

Georg


Nov 18 '05 #2

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

Similar topics

1
by: Keith Harris | last post by:
Hi, I have a Repeater control which is bound to a dataset. In the footer of the repeater control, I have a Button whose visibility I want to vary according to the sum of a column being > 0. ...
2
by: Stephen Miller | last post by:
I am using the OnItemDataBound event of Repeater control to nest a DataGrid within the Repeater. When I attempt to bind to the DataGrid using the DataSource method I get the error message "Object...
1
by: Dobedani | last post by:
Dear All, I would like to use a Repeater to show data - mostly large volumes from a database - in a comma delimited format. VS.NET documentation mentions this as one of the uses of the Repeater!...
5
by: Darren Smith | last post by:
Hi There, I have a shopping cart app that displays products along with a textbox (to enter quantity) and an image button to add the item to the shopping cart. Please explain why my below...
1
by: Willy | last post by:
Hi There! Is there any way to include a User Control (ASCX) in the <ItemTemplate> of the ASP.NET Repeater control? To be more exact, I need to include a user control AND set some properties of...
3
by: Ben Dewey | last post by:
Hey everyone, I have a wierd issue i can't seem to find out whats going on. I have a Control for a Shopping Cart Merchant Page called OrderStatus.ascx Inside that control there is a Repeater...
9
by: sck10 | last post by:
Hello, I am building a web form that will be used to gather information for marketing plans. The form will have 15 questions which must be answered. Each question can have large blocks of text....
7
by: | last post by:
I have what's probably a simple page lifecycle question related to dynamically evaluating values that are placed by a repeater and dynmically placing user controls that use those values. I'm...
4
by: Ahmd | last post by:
I have a Repeater to which a sitemap is bound, i want to remove or hide any node while form load <asp:Repeater runat="server" ID="menu" DataSourceID="SiteMapDataSource1" EnableViewState="False">...
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
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.