【发布时间】:2012-08-29 12:28:55
【问题描述】:
如果我单击 ListView 中的按钮,我想打开 Outlook。这是怎么...
<a href="mailto:user@example.com">Send email to user@example.com</a>
我有一个...
<asp:LinkButton ID="LinkButton1" runat="server">LinkButton</asp:LinkButton>
没有网址。 Url 从 ListView 获取此 LinkButton 并且它可以工作,但在此之后我无法激活此 LinkButton :(
这是怎么...
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?????
}
}
如何在不点击的情况下激活链接按钮?
【问题讨论】:
-
你为什么要使用 ItemCommand 呢?你不能设置mailto:直接在你的listview中用eval链接。
标签: c# asp.net email listview linkbutton