I'm trying to create a GridView on page which lists the administrators for a system and there email address.
I would like to make it so that the administrators email address is displayed as a mail-to
link.
At the moment I have got that working however the browser keeps trying to open the mail-to
address as if its a web address and of course returns a 404 error.
Is there a way to stop the browser redirecting to the mail-to
address?
I am using a hyperlink as an item template in the asp definition of the GridView, like this :
<asp:TemplateField>
<ItemTemplate>
<asp:HyperLink ID="HyperLink2" runat="server" Text='<%# Eval("E-mail") %>'
NavigateUrl='<%# Eval("E-mail", "mailto:{0}") %>' Target=""></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
As I mentioned previously, the code does generate the mail-to
link as expected but the browser keeps trying to redirect to it and I would like it not to do that and just stay on the same page instead.
Obviously I am using ASP.net and C# for this project.
请尝试以下操作,可能会帮助您...
NavigateUrl='<%# String.Format("mailto:{0}", Eval("E-mail"))%>'
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.