Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Using a databound element as an attribute


Message #1 by "Jeff Edwards" <jedwards_1@c...> on Wed, 13 Nov 2002 13:53:56 -0600
I have used a data repeater to pull up news items and format the output.
While this compiles OK, I get an error "Expression expected"

<A href="News.aspx?SelectedID=<%# DataBinder.Eval(Container.DataItem,
'NewsID') %>">					<%#
DataBinder.Eval(Container.DataItem, "HeadLine") %> </A>

Using the databound element as an attribute does causes the error. Can
anyone give me a pointer on what the best way to correct this is?

Message #2 by "Dave Rezoski" <daverezoski@h...> on Wed, 13 Nov 2002 23:11:22 +0000
try this:

<A href='News.aspx?SelectedID=<%# DataBinder.Eval(Container.DataItem,
"NewsID") %>'>					<%#
DataBinder.Eval(Container.DataItem, "HeadLine") %> </A>





----Original Message Follows----
From: "Jeff Edwards" <jedwards_1@c...>
Reply-To: "ASP.NET" <aspx@p...>
To: "ASP.NET" <aspx@p...>
Subject: [aspx] Using a databound element as an attribute
Date: Wed, 13 Nov 2002 13:53:56 -0600

I have used a data repeater to pull up news items and format the output.
While this compiles OK, I get an error "Expression expected"

<A href="News.aspx?SelectedID=<%# DataBinder.Eval(Container.DataItem,
'NewsID') %>">					<%#
DataBinder.Eval(Container.DataItem, "HeadLine") %> </A>

Using the databound element as an attribute does causes the error. Can
anyone give me a pointer on what the best way to correct this is?




_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8. 
http://join.msn.com/?page=features/junkmail


  Return to Index