PC Review


Reply
Thread Tools Rate Thread

Problem Using Data Binding Tags

 
 
Wayne Wengert
Guest
Posts: n/a
 
      23rd May 2004
I am trying to modify the output of a repeater control based on values in
the source database. If I simply want to display the contents of a specific
field I use a syntax such as:

<td><%# Container.DataItem("Author") %></td>

This works fine but when I want to use a bound value in program logic I get
"Expression Expected" and/or other errors. I am trying code similar to the
following:

<%
If (<%#Container.DataItem("StartDate")%> > lastdate) then
lastdate = <%#Container.DataItem("StartDate") %>
Response.Write("<tr><td colspan='4'><h3>" & lastdate &
"</h3></td></tr>")
End If
Dim strTemp As String
strTemp = <%#Container.DataItem("StartDate")%>.ToString( "d" )
Response.Write("<td>" & strTemp & "</td>")
%>

I've tried eliminating the <% and %> in the binding tag since it is already
within a code block but that also fails.

What is the correct way to code this?

Wayne


 
Reply With Quote
 
 
 
 
Calvin Luttrell/ProjectThunder.com
Guest
Posts: n/a
 
      24th May 2004
Wayne,

There may be a way to do what you are trying to do. To be honest I think I would tell you to loop through the datatable and change the values there. I get the impression you are a ASP developer moving to .Net. Try using the .Net Controls like a DataList you may find some use in that.

-Calvin Luttrell
ProjectThunder.com

> I am trying to modify the output of a repeater control based on values in
> the source database. If I simply want to display the contents of a specific
> field I use a syntax such as:
>
> <td><%# Container.DataItem("Author") %></td>
>
> This works fine but when I want to use a bound value in program logic I get
> "Expression Expected" and/or other errors. I am trying code similar to the
> following:
>
> <%
> If (<%#Container.DataItem("StartDate")%> > lastdate) then
> lastdate = <%#Container.DataItem("StartDate") %>
> Response.Write("<tr><td colspan='4'><h3>" & lastdate &
> "</h3></td></tr>")
> End If
> Dim strTemp As String
> strTemp = <%#Container.DataItem("StartDate")%>.ToString( "d" )
> Response.Write("<td>" & strTemp & "</td>")
> %>
>
> I've tried eliminating the <% and %> in the binding tag since it is already
> within a code block but that also fails.


 
Reply With Quote
 
Wayne Wengert
Guest
Posts: n/a
 
      24th May 2004
Calvin;

You are correct. I have been using classic ASP/VB/ADO and the transition to
..NET is not easy! I am trying to find samples via google searches and books
but finding practical solutions is not easy. Many of the examples I see are
"way over the top" with what seems to be overly complex solutions.

Wayne

"Calvin Luttrell/ProjectThunder.com" <(E-Mail Removed)> wrote in
message news:(E-Mail Removed)...
Wayne,

There may be a way to do what you are trying to do. To be honest I think I
would tell you to loop through the datatable and change the values there. I
get the impression you are a ASP developer moving to .Net. Try using the
..Net Controls like a DataList you may find some use in that.

-Calvin Luttrell
ProjectThunder.com

> I am trying to modify the output of a repeater control based on values in
> the source database. If I simply want to display the contents of a

specific
> field I use a syntax such as:
>
> <td><%# Container.DataItem("Author") %></td>
>
> This works fine but when I want to use a bound value in program logic I

get
> "Expression Expected" and/or other errors. I am trying code similar to the
> following:
>
> <%
> If (<%#Container.DataItem("StartDate")%> > lastdate) then
> lastdate = <%#Container.DataItem("StartDate") %>
> Response.Write("<tr><td colspan='4'><h3>" & lastdate &
> "</h3></td></tr>")
> End If
> Dim strTemp As String
> strTemp = <%#Container.DataItem("StartDate")%>.ToString( "d" )
> Response.Write("<td>" & strTemp & "</td>")
> %>
>
> I've tried eliminating the <% and %> in the binding tag since it is

already
> within a code block but that also fails.



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
100K item data binding: Is asynchronous data binding possible? R Reyes Microsoft C# .NET 14 5th Feb 2008 10:47 PM
Databindings and XML - Binding Text between XML Tags instead of XMLTag Atrribute Information theintrepidfox Microsoft ASP .NET 0 26th Nov 2007 01:55 PM
data binding problem Nikolay Microsoft C# .NET 0 18th Mar 2006 04:04 PM
data binding: using text and tags. oracle Microsoft C# .NET 0 14th Dec 2005 09:44 PM
Data tags problem Tim Microsoft Excel Charting 1 15th Apr 2004 12:53 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:14 AM.