首先调用服务器端代码然后调用客户端脚本而不使用AJAX

时间:2022-07-17 19:39:31

in a form i have a buttoin, when click both OnclientClick and postback should happen. on clicking the "Email" button a client side "mailto" tag should do the work and pull a new message window on the client's machine.

在一个形式我有一个buttoin,当点击OnclientClick和回发应该发生。单击“电子邮件”按钮时,客户端“mailto”标签应该完成工作并在客户端的计算机上拉出一个新的消息窗口。

whereas, the email addresses should be invoked by the post back. so , when clicking the button the server side post should happen and on return the client side script should be invokded with the values read during post back, and populate all the email addresses.

而邮件地址应该由邮寄回调用。因此,当单击按钮时,服务器端帖子应该发生,并且在返回时,客户端脚本应该使用回发期间读取的值进行调用,并填充所有电子邮件地址。

i need know how to first do a server hit take the values and then execute the client script with those values without using AJAX

我需要知道如何首先执行服务器命中取值,然后使用这些值执行客户端脚本而不使用AJAX

1 个解决方案

#1


0  

You can use the RegisterStartupScript method to add a script to the page from the code behind. Example:

您可以使用RegisterStartupScript方法从后面的代码向页面添加脚本。例:

Page.ClientScript.RegisterStartupScript(
  this.GetType(),
  "mail",
  "window.location.href='mailto:" + emailAddress + "';",
  true
);

#1


0  

You can use the RegisterStartupScript method to add a script to the page from the code behind. Example:

您可以使用RegisterStartupScript方法从后面的代码向页面添加脚本。例:

Page.ClientScript.RegisterStartupScript(
  this.GetType(),
  "mail",
  "window.location.href='mailto:" + emailAddress + "';",
  true
);