I want open Outlook if I click on a Button in a ListView. how this...
<a href="mailto:[email protected]">Send email to [email protected]</a>
I have a ...
<asp:LinkButton ID="LinkButton1" runat="server">LinkButton</asp:LinkButton>
without a url. The Url get this LinkButton from the ListView and it works but i don't can activate this LinkButton after this :(
how this...
protected void myListView_ItemCommand(object sender, ListViewCommandEventArgs e)
{
if (e.CommandName == "mailto")
{
int index = Convert.ToInt32(e.CommandArgument);
LinkButton lb = (LinkButton)myListView.Items[index].FindControl("Label2");
string mailto = lb.Text;
LinkButton1.PostBackUrl = "mailto:" + mailto;
LinkButton1.ResolveClientUrl("mailto:" + mailto); //Here?????
}
}
How I can activate the LinkButton wthout click on this?
If you're stuck on using a button, then set the ClientClick property. Use return false;
to cancel the postback. If you want the postback, then leave it off.
LinkButton1.ClientClick = "window.open('mailto:[email protected]', 'email'); return false;";