html parser error message: Parser Error Message: The server tag is not well formed
I am getting the error Parser Error Message: The server tag is not well formed. on the code line below:
开发者_JS百科<asp:HyperLink ID="imgFileType" ImageUrl="images/Icon_Pdf.gif" NavigateUrl='<%#"javascript:ViewFile('erg_", Eval("DocumentName") %>' runat="server"></asp:HyperLink>
I need the url link to be parsed as:
javascript:ViewFile('erg_Invoice_3200_QRG_Restaurant.pdf');
What am I missing in the syntax?
You cannot do that. The single quote double quote mess will make the compiler complain.
Please write a helper.
Markup
NavigateUrl='<%# SetNavigateUrl(Eval("DocumentName")) %>'>
Code-Behind
protected string SetNavigateUrl(object objName)
{
return String.Format("javascript:ViewFile('erg_{0}');", objName.ToString());
}
精彩评论