国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

.NET中利用js讓子窗體向父頁面傳值的實現方法

2024-07-10 12:46:29
字體:
來源:轉載
供稿:網友

子頁面C#后臺代碼:
代碼如下:
/// <summary>  
     /// 將設置好的值賦給父頁面  
     /// </summary>  
     /// <param name="count">需要傳遞的值</param>  
     void SetValueToParentPage(int count, string strPersons) 
     { 
         StringBuilder jsStr = new StringBuilder(); 
         jsStr.Append(" var retValue = new Object();"); 
         if (count == 0) 
         { 
             jsStr.AppendFormat("retValue = null;"); 
         } 
         else 
         { 
             jsStr.AppendFormat("retValue.Nums='{0}';", count); 
             jsStr.AppendFormat("retValue.Names='{0}';", strPersons); 
         } 
         jsStr.Append("window.returnValue = retValue;window.close();"); 

         ClientScript.RegisterStartupScript(GetType(), "close", jsStr.ToString(), true); 
     } 


父頁面前臺js:
代碼如下:
function OpenPerChoose(url) { 
          var openobj = window; 
          if (typeof (window.dialogArguments) == "object") { 
              openobj = window.dialogArguments; 
          } 
          var returnValue = showPopWin(url, 800, 600, openobj); 
          if (returnValue != null) { 
              document.getElementById("<%=txtQualifiedNums.ClientID %>").value = returnValue.Nums; 
          } 
      } 


代碼如下:
//彈出窗口  
function showPopWin(url, width, height, returnFunc) { 
    width = parseInt(width) + 30; 
    height = parseInt(height) + 30; 
    return window.showModalDialog(url + "&Datetime=" + GetTime(), document, "dialogWidth:" + width + "px;dialogHeight:" + height + "px;help:0;status:0;scroll:auto;center:1;resizable:1;"); 

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 黑河市| 浦东新区| 恩平市| 池州市| 商丘市| 凭祥市| 阳信县| 阳泉市| 阿城市| 武威市| 秭归县| 余庆县| 闽清县| 宜君县| 呼图壁县| 烟台市| 昌邑市| 嘉兴市| 饶河县| 洪雅县| 马龙县| 英山县| 昌乐县| 平陆县| 梧州市| 岳西县| 晋州市| 广饶县| 凤庆县| 秀山| 天柱县| 苗栗县| 丹东市| 象州县| 红原县| 丽江市| 高安市| 江北区| 清原| 玉溪市| 淮滨县|