1.在*.aspx页面中调用*.aspx.cs中的方法....
aspx.cs代码:
public string FormatStr(string mystr)
{
   ...........
   
}
aspx代码:
<%# FormatStr(绑定)%>
在aspx.cs引用某个空间a,刚可以直接在aspx页面使用a命名空间下的方法。

2、服务器的脚本调用方法,弹出窗口等;

asp.net里可以方便的使用:Response.Write("<script>alert('do you delete?');</script>");
但是效果很差,弹出窗口时一片空白(白屏),很差的用户体验效果;

无刷新的弹出窗口(无白屏)
Label1 .Text = "<script>alert('do you delete?');</script>";   (页面放一个label控件用来提示信息)

Page.RegisterStartupScript("tip", "<script>alert('do you delete?');</script>");  (注册脚本的方法)

Page.RegisterStartupScript("tip", "<script>alert('do you delete?');window.location='default.aspx';</script>");  //点击后跳转

相关文章:

  • 2022-12-23
  • 2021-10-28
  • 2021-04-02
  • 2021-07-11
  • 2021-09-10
  • 2022-12-23
  • 2021-06-08
  • 2022-03-06
猜你喜欢
  • 2022-01-17
  • 2022-01-29
  • 2022-12-23
  • 2022-01-29
  • 2022-01-29
  • 2022-01-29
相关资源
相似解决方案