简体   繁体   中英

Parser Error The server tag is not well formed

<asp:HyperLink runat="server" Text='<%# Path.GetFileName(Eval("MediaFileLink").ToString()) %>'
                NavigateUrl='<%# String.Format("http://www.someurlwithparams.com/{0}", Path.GetFileNameWithoutExtension(Eval("MediaFileLink").ToString()).Substring(0, Path.GetFileNameWithoutExtension(Eval("MediaFileLink").ToString()).IndexOf('_'))) %>' Target="_blank" />

I get the Parser Error Message: The server tag is not well formed. I already checked for missing closing tags or double quotes but somehow I miss the error.

IndexOf method probably causing this issue as it closes you server tag at first ' symbol. Try to change it to ToString().IndexOf("_")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM