2009-10-21 4 views
-1

Je suis en train de formater un contrôle literal sur une page code-behind:erreur de compilation dans le code ASP.NET lors de l'ajout d'un contrôle Literal

BillerLiteral.Text = "<p class="'no-margin'"/>" + attendee1.FirstName + " " + 
attendee1.LastName + "</p> <p class=""no-margin"">" + attendee1.Address1 + "," + 
attendee1.Address2 + "</p><p class=""margin"">" + attendee1.City + "," + 
attendee1.State + " " + attendee1.ZipCode + "</p><p>" + attendee1.Email + "</p>"; 

Juste après avoir ajouté cette ligne, je reçois des erreurs de compilation même bien qu'il compile bien.

Compilation Error Description: An error occurred during the compilation of a 
resource required to service this request. Please review the following specific 
error details and modify your source code appropriately. 

Compiler Error Message: The compiler failed with error code 1. 

est ici la sortie du compilateur détaillé:

c:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE> "c:\Window 
\Microsoft.NET\Framework\v3.5\csc.exe" /t:library /utf8output /R:"C:\Windows 
\assembly\GAC_MSIL\System.ServiceModel\3.0.0.0__b77a5c561934e089 
\System.ServiceModel.dll" 
/R:"C:\Windows\assembly\GAC_MSIL\System.Web.Services\2.0.0.0__b03f5f7f11d50a3a 
\System.Web.Services.dll" /R:"C:\Windows\assembly\GAC_32\System.Data 
\2.0.0.0__b77a5c561934e089\System.Data.dll" /R:"C:\Windows\assembly\GAC_MSIL 
\System.Runtime.Serialization\3.0.0.0__b77a5c561934e089 
\System.Runtime.Serialization.dll" /R:"C:\Windows\assembly\GAC_MSIL\System 
\2.0.0.0__b77a5c561934e089\System.dll" /R:"C:\Windows\assembly\GAC_MSIL 
\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll" /R: 
"C:\Windows\assembly\GAC_MSIL\System.WorkflowServices\3.5.0.0__31bf3856ad364e35 
\System.WorkflowServices.dll" /R:"C:\Windows\assembly\GAC_32\ 
System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\ 
System.EnterpriseServices.dll" 
/R:"C:\Windows\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a 
\System.Configuration.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.IdentityModel 
\3.0.0.0__b77a5c561934e089\System.IdentityModel.dll" /R:"C:\Windows\assembly 
\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.dll" /R: 
"C:\Windows\assembly\GAC_MSIL\System.Web.Mobile\2.0.0.0__b03f5f7f11d50a3a 
\System.Web.Mobile.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Xml 
\2.0.0.0__b77a5c561934e089\System.Xml.dll" /R:" 
C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll" 
/R:"C:\Windows\assembly\GAC_MSIL\System.ServiceModel.Web 
\3.5.0.0__31bf3856ad364e35\System.ServiceModel.Web.dll" 
/R:"C:\Windows\assembly\GAC_MSIL\System.Web.Extensions\3.5.0.0__31bf3856ad364e35 
\System.Web.Extensions.dll" /R:"C:\Windows\assembly\GAC_MSIL 
\System.Data.DataSetExtensions\3.5.0.0__b77a5c561934e089 
\System.Data.DataSetExtensions.dll" /R:"C:\Users\jeffreyeas\AppData\Local 
\Temp\Temporary ASP.NET Files\awchallenge\ae85f60c\8aef9183\App_Code.fkizkk6y.dll" 
/R:"C:\Windows\assembly\GAC_MSIL\System.Xml.Linq\3.5.0.0__b77a5c561934e089 
\System.Xml.Linq.dll" /R:"C:\Windows\assembly\GAC_32\System.Web 
\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll" /out:"C:\Users\jeffreyeas\AppData\Local 
\Temp\Temporary ASP.NET Files\awchallenge\ae85f60c\8aef9183 
\App_Web_page_two.aspx.cdcab7d2.dkslispb.dll" /D:DEBUG /debug+ /optimize- 
/win32res:"C:\Users\jeffreyeas\AppData\Local\Temp\Temporary ASP.NET Files\awchallenge 
\ae85f60c\8aef9183\vuyv4kby.res" /w:4 /nowarn:1659;1699;1701 /warnaserror- 
"C:\Users\jeffreyeas\AppData\Local\Temp\Temporary ASP.NET Files\awchallenge\ae85f60c 
\8aef9183\App_Web_page_two.aspx.cdcab7d2.dkslispb.0.cs" "C:\Users\jeffreyeas\AppData 
\Local\Temp\Temporary ASP.NET Files\awchallenge\ae85f60c\8aef9183 
\App_Web_page_two.aspx.cdcab7d2.dkslispb.1.cs" "C:\Users\jeffreyeas\AppData\Local 
\Temp\Temporary ASP.NET Files\awchallenge\ae85f60c\8aef9183 
\App_Web_page_two.aspx.cdcab7d2.dkslispb.2.cs" 

Qu'est-ce que je manque?

+0

Si vous utilisez string.Format votre code sera plus performant et plus facile à lire. –

Répondre

3

Vos citations sont fausses dans "<p class="'no-margin'"/>"

+2

En outre, il semble que cette étiquette se ferme automatiquement. –

1
BillerLiteral.Text = "<p class=\"no-margin\"/>" + attendee1.FirstName + " " + attendee1.LastName + "</p> <p class=\"no-margin\">" + attendee1.Address1 + "," + attendee1.Address2 + "</p><p class=\"margin\">" + attendee1.City + "," + attendee1.State + " " + attendee1.ZipCode + "</p><p>" + attendee1.Email + "</p>"; 

essayer cette

Questions connexes