473,378 Members | 1,142 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,378 software developers and data experts.

Data Binding in a Repeater

I'm having trouble with my repeater:

I'm binding my Repeater control to an OleDbDataReader object. My ASPX looks
like this:

<asp:Repeater ID="Rptr" runat="server">
<ItemTemplate>
<asp:Label ID="LB" runat="server" Text="" />
<br/>
<%# Eval("TextBody") %>
<br />
<%# Eval("ID") %>
<br />
<%# Eval("Owner") %>
<br />
<%# Eval("CreateDate") %>
</ItemTemplate>
</asp:Repeater>

If I do the above, all works fine. BUT, if I try to set the Text property of
a control such as...
<asp:Label ID="LB" runat="server" Text="<%# Eval("Owner") %>" />

then, I get "The server tag is not well formed" for that Label. Is this
because of the double-quotes that have to be inside the Eval("")?

Also, one other thing: How can I do date formatting for date values coming
back?

Thanks.

Alex

Jun 13 '06 #1
3 1533
Experiment with single and double quotes.
<asp:Label ID="LB" runat="server" Text='<%# Eval("Owner") %>' />

or try a few different permutations.

"Alex Maghen" <Al********@newsgroup.nospam> wrote in message
news:D9**********************************@microsof t.com...
I'm having trouble with my repeater:

I'm binding my Repeater control to an OleDbDataReader object. My ASPX looks like this:

<asp:Repeater ID="Rptr" runat="server">
<ItemTemplate>
<asp:Label ID="LB" runat="server" Text="" />
<br/>
<%# Eval("TextBody") %>
<br />
<%# Eval("ID") %>
<br />
<%# Eval("Owner") %>
<br />
<%# Eval("CreateDate") %>
</ItemTemplate>
</asp:Repeater>

If I do the above, all works fine. BUT, if I try to set the Text property of a control such as...
<asp:Label ID="LB" runat="server" Text="<%# Eval("Owner") %>" />

then, I get "The server tag is not well formed" for that Label. Is this
because of the double-quotes that have to be inside the Eval("")?

Also, one other thing: How can I do date formatting for date values coming
back?

Thanks.

Alex

Jun 14 '06 #2
Hi Alex,

I agree with Sloan's suggestion. VS IDE's html designer won't allow nested
quotes. Therefore as for databinding expression which will need multiple
quotes(nested), we use single quote to replace the outer pair.

Regards,

Steven Cheng
Microsoft MSDN Online Support Lead
==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jun 14 '06 #3
Hey Alex,

Does that suggestion help you resolve the problem? If you still have any
question on this, please feel free to post here.

Regards,

Steven Cheng
Microsoft MSDN Online Support Lead
==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jun 15 '06 #4

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

Similar topics

2
by: Jordan | last post by:
I'm curious if the whole point of Repeaters/Data Lists/Grids is encapsulating additional functionality like add/update/edit/deletes, but really does not provide any benefits when it comes to simply...
2
by: Paul K | last post by:
I'm having a problem getting the data binding to work with the repeater control. Here's the code for the code-behind class private void Page_Load(object sender, System.EventArgs e if...
1
by: Dot net work | last post by:
Hello. I have an interesting data binding scenario: I have a repeater control. It repeats a typical custom web user control. I also have a collection object, and each collection element...
8
by: darrel | last post by:
*sigh*...I've asked this before, but have long forgotten the answer. In the past, I'd often use repeater controls, bind data to it, and then reference the data fields from within the repeater: ...
3
by: Joel Daniels | last post by:
Hello, I am trying to determine the proper way to access the underlying data row for a Repeater item in the ItemCommand event. In the page load event, I bind the Repeater data source to a...
0
by: | last post by:
ASP.NET 2.0 simplifies binding datasources to controls like the repeater. These new methods allow nearly code-less mechanisms to dump data to a page. I like this new feature a whole lot. HTML...
4
by: Joel | last post by:
Hey all- I'm new to asp.net so please bear with me -- I'm attempting to reference the repeater's Container.DataItem outside the repeater object. In other words -- In a seperate sub routine:...
4
by: Alan Silver | last post by:
Hello, I'm trying to use an ArrayList to do data binding, but am getting an error I don't understand. I posted this in another thread, but that was all confused with various other problems,...
4
by: Brad Baker | last post by:
I'm going a little crazy :) I'm trying to bind a repeater control to a dataset on page load using the following code: if (Request.QueryString != null) { string customerid = Request.QueryString;...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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...

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.