compiler failed with error code 1.

A

Andy B

I have the following code:

<asp:Label ID="Label1" runat="server" Text='<%# "<h2
style=\"Text-Align:Center\">"+Eval("Title")+"</h2><br /><span
style=\"Text-Align:Center\">"+Eval("CreationDate", "{0:f}")+"</span><br
/><span style=\"Text-Align:Center\">"+Eval("Description") + "</span>"
%>'></asp:Label>

I get this error when trying to run the page:

C:\Documents and Settings\Andy\My Documents\Visual Studio
2008\Projects\Eternity Records(VB)\WebRoot\index.aspx(13) : error BC32017:
Comma, ')', or a valid expression continuation expected.
 
H

Hans Kesting

After serious thinking Andy B wrote :
I have the following code:

<asp:Label ID="Label1" runat="server" Text='<%# "<h2
style=\"Text-Align:Center\">"+Eval("Title")+"</h2><br /><span
style=\"Text-Align:Center\">"+Eval("CreationDate", "{0:f}")+"</span><br
/><span style=\"Text-Align:Center\">"+Eval("Description") + "</span>"
%>'></asp:Label>

I get this error when trying to run the page:

C:\Documents and Settings\Andy\My Documents\Visual Studio
2008\Projects\Eternity Records(VB)\WebRoot\index.aspx(13) : error BC32017:
Comma, ')', or a valid expression continuation expected.

Your directoryname ("Eternity Records(VB)") seems to suggest that you
use VB. Is \" in VB an escape for "just a quote"? (It *is* in C#).

Do you need to have everything in a single <asp:label>? Or could you
split this expression: have all the Eval's in separate blocks and move
the fixed strings outside the databinding block.

Sort of:
<h2 style="Text-Align:Center"><%# Eval("Title") %></h2><br />
<span style="Text-Align:Center"><%#Eval("CreationDate", "{0:f}") %>
</span><br/>
<span style="Text-Align:Center"><%# Eval("Description") %></span>

Hans Kesting
 
A

Andy B

That is how it needs to be done. Everything has to be inside the label
control and done inside the markup. I don't know what the escape character
for vb is... anybody know?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top