How to launching email client on LinkButton click event?

前端 未结 2 1466
被撕碎了的回忆
被撕碎了的回忆 2020-12-20 20:21

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.

2条回答
  •  萌比男神i
    2020-12-20 20:35

    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:

    btnEmail.OnClientClick = "window.location.href = 'mailto:someone@something.com?subject=Email Subject';";
    

提交回复
热议问题