mailto: from GridView row to allow the user to send emails

If you want to create a HyperLinks in the GridView , so that if the user click on one link the outlock (or email client) will be opened and carry the clicked email ?

If we assumed that the User Email is stored in a column called "Email" , then you can use the following Column inside the GridView or any other Data Control:

<asp:TemplateField HeaderText="EMail" SortExpression="EMail">
    <ItemTemplate>
        <asp:HyperLink ID="HyperLink1" runat="server" 
            NavigateUrl='<%# Eval("EMail", "mailto:{0}") %>' Text='<%# Eval("EMail") %>'></asp:HyperLink>
    </ItemTemplate>
</asp:TemplateField>

No Comments