asp.net中javascript与后台c#交互

2019-05-22 23:58:38于丽

以下是代码片段:

 .aspx 
  function GetTitleID(obj) 
  { 
  sTitleID=obj 
  if(sTitleID!=null) 
  document.getElementByIdx_x("HiddenField1").value=type+','+sTitleID; 
  else 
  document.getElementByIdx_x("HiddenField1").value=type+',0'; 
  } 
  .cs 
  string hiddenValue = this.HiddenField1.Value;

方法三:Page.RegisterStartupScript("function","<script>你要调用的javascript函数名称;</script>");

以上就是asp.net中javascript与后台c#交互的方法,每一种情况都有对应的解决方法,希望能够帮助到大家。