如何在 LinkButton 单击事件上启动电子邮件客户端?
如何启动 Outlook 电子邮件窗口(类似于超链接中的 mailto: 功能)?
这需要在 LinkButton
点击事件中完成。
How can I launch an Outlook email window (similar to what mailto: does in a hyperlink) ?
This needs to be done in a LinkButton
click event.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
考虑到 mailto 功能是需要在客户端发生的功能。你将需要 javascript 来完成它。根据您希望邮件发送的时间,您有两种选择。
如果您希望它在单击 LinkButton 后立即发生,则只需添加到
LinkButton
的OnClientClick
事件:如果您希望它在服务器端代码之后发生运行您将连接 javascript 事件以在新页面启动时运行:
希望有帮助。
Consider that the mailto functionality is a function that needs to happen client side. You are going to need javascript to do it. Depending on when you want the mailto to happen you have two choices.
If you want it to happen as soon as the LinkButton is clicked then just add to the
LinkButton
'sOnClientClick
event:If you want it to happen AFTER the server side code has run your are going to have wire up the javascript event to run when the new page starts up:
Hope that helps.
我使用 LinkButton 的
OnClientClick
事件完成了此操作。您可以使用:
您也可以在代码中执行此操作,以防您需要从数据库或其他内容加载电子邮件地址:
I've accomplished this using the
OnClientClick
event of the LinkButton.You can use:
You can also do this in code, in case you need to load an email address from a database or something: