C# 如何在不点击链接按钮的情况下激活链接按钮?
如果单击列表视图中的按钮,我希望打开Outlook。这怎么C# 如何在不点击链接按钮的情况下激活链接按钮?,c#,asp.net,email,listview,linkbutton,C#,Asp.net,Email,Listview,Linkbutton,如果单击列表视图中的按钮,我希望打开Outlook。这怎么 <a href="mailto:user@example.com">Send email to user@example.com</a> protected void myListView_ItemCommand(object sender, ListViewCommandEventArgs e) { if (e.CommandName == "mailto") { int in
<a href="mailto:user@example.com">Send email to user@example.com</a>
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?????
}
}
如何在不点击链接按钮的情况下激活链接按钮?尝试使用:
尝试使用:
只需使用链接
<asp:HyperLink ID="hl" runat="server" NavigateUrl = ..." Text ="link"></asp:HyperLink>
塔拉索夫你能在这里找到所有的财产吗
只需使用链接
<asp:HyperLink ID="hl" runat="server" NavigateUrl = ..." Text ="link"></asp:HyperLink>
塔拉索夫你能在这里找到所有的财产吗
使用超链接而不是链接按钮
<asp:HyperLink ID="HyperLink1" runat="server"
NavigateUrl="mailto:user@example.com" >HyperLink</asp:HyperLink>
超链接
使用超链接而不是链接按钮
<asp:HyperLink ID="HyperLink1" runat="server"
NavigateUrl="mailto:user@example.com" >HyperLink</asp:HyperLink>
超链接
如果无法使用按钮,请设置ClientClick属性。使用返回false
取消回发。如果你想要回邮,那就不要回邮
LinkButton1.ClientClick = "window.open('mailto:someone@somewhere.com', 'email'); return false;";
如果无法使用按钮,请设置ClientClick属性。使用返回false
取消回发。如果你想要回邮,那就不要回邮
LinkButton1.ClientClick = "window.open('mailto:someone@somewhere.com', 'email'); return false;";
为什么要为此使用ItemCommand?您不能在您的listview中直接使用eval设置mailto:链接。为什么要使用ItemCommand进行此设置?您不能使用eval在listview中直接设置mailto:链接吗。