前台后台相互调用(js调用c# & c#调用js)

一、 C#调用js

 

View Code
1 html
2 
3 function FunctionName() {}
4 
5 .cs文件
6 
7 Page.ClientScript.RegisterStartupScript(this.GetType(), "key(随便起名字)", "<script>FunctionName();</script>");

 

 

二、JS调用C#

View Code
 1 html
 2 
 3 "<%=FunctionName()%>"
 4 
 5  
 6 
 7  .cs文件
 8 
 9 public string FunctionName()
10 {
11 
12 string s=string.Empty;
13 
14 ..............
15 
16 return s;
17 
18 }

 

 

 

 

posted @ 2013-04-23 11:55  yuchao.xia  阅读(194)  评论(0编辑  收藏  举报