讓ASP.NET簡便使用SCRIPT
2006/10/13 9:36:42
在開發ASP.NET應用程序過程中編寫Script是件很煩人的事情,其實我們可以把常用的Script裝成相應的.NET組件在服務端調用,這樣可以大大簡化Script的編寫還提高的Script的重用.

以下是常用的打開模式窗體并獲取返回值的類調用,實際上可以給設置多個參數傳入和不同控件獲取不同返回值的結果.

定義打開窗體并設置返回值腳本類.
HFSoft.Web.Scripts.ShowModalDialog dialog=new HFSoft.Web.Scripts.ShowModalDialog(
XXX.Units.Config.WebBoot+"Appunit/WindowOpenDialog.aspx",
FrmFailureLogSearch.PageURI());
dialog.Height=400;
dialog.Width=600;
dialog.ReturnElements.Add(new HFSoft.Web.Scripts.ReturnElement(this.txtReturn.ClientID,"ReturnString"));
HFSoft.Web.Scripts.RegisterScript.RegiOnClick(cmdSearch,dialog);

打開窗體設置返回值的代碼
HFSoft.Web.Scripts.ReturnValues returnValue=new HFSoft.Web.Scripts.ReturnValues();
returnValue.Add("ReturnString",filter);
HFSoft.Web.Scripts.RegisterScript.RegiPageClient(this,"return",returnValue);

打開窗體類的代碼(其實很多Script都可以通過這樣的方式來封裝).

00006 namespace HFSoft . Web . Scripts

00007 {

00008 ///

00009 /// 創建打開窗體腳本類

00010 /// 注意:返回值參數據接收的數據格式必須

00011 /// key=value|key1=value1|.....

00012 ///

00013 public class ShowModalDialog : IExecuteScript

00014 {

00015 private const string _Dialog ="window.showModalDialog({0},' ',' dialogHeight : { 1 } px ;

dialogWidth : { 2 } px ; edge : Raised ; center : Yes ; help : No ; resizable : No ; status : No ; scroll :

Yes ;');" ;

00016 #region IExecuteScript 成員

00017 private bool mParent = false ;

00018 ///

00019 /// 是否需要加載父指向

00020 ///

00021 public bool Parent

00022 {

00023 get

00024 {

00025 // TODO: 添加 SetElementsValue.Parent getter 實現

00026 return mParent ;

00027 }

00028 set

00029 {

00030 // TODO: 添加 SetElementsValue.Parent setter 實現

00031 mParent = value ;

00032 }

00033 }

00034 private string GetParent ()

00035 {

00036 if ( Parent )

00037 return "parent." ;

00038 return "" ;

00039 }

00040 ///

00041 /// 構造對象

00042 ///

00043 ///
容器頁

00044 ///
具本打開的頁面

00045 public ShowModalDialog ( string pageContainer , string openPage )

00046 {

00047 PageContainer = pageContainer ;

00048 OpenPage = openPage ;

00049 }

00050 public const string PageUrlTag ="pageurl" ;

00051 ///

00052 /// 生成腳本

00053 ///

00054 /// string

00055 public string Execute ()

00056 {

00057 // TODO: 添加 ShowModalDialog.Execute 實現

00058 string url ="' " + PageContainer +" ? pageurl ='+" + GetPage ();

00059 url = string . Format ( _Dialog , url , Height , Width );

00060 url = GetParent () + url ;

00061 if ( ReturnElements . Count >0)

00062 {

00063 url = "var getvalue=" + url +";if(getvalue != null){" ;

00064 foreach ( ReturnElement item in ReturnElements )

00065 {

00066 url += item . GetScript ( GetParent ());



--------------------------------------------------------------------------------


00067 }

00068 url +="}" ;

00069 return

下一頁
返回列表
返回首頁 主站蜘蛛池模板: 国产在线乱子伦一区二区| 中国jizzxxxx| 欧美日韩亚洲国产精品| 公与秀婷厨房猛烈进出视频| 陪读妇乱子伦小说| 国产疯狂露脸对白| 91精品国产免费久久久久久青草| 少妇无码AV无码一区| 久久亚洲国产成人精品性色| 欧美不卡在线视频| 亚洲熟妇无码AV不卡在线播放| 精品国产一区二区三区不卡| 国产乱人伦偷精品视频下| 黄色福利在线观看| 国产精品成人va在线观看入口| av天堂午夜精品一区| 很黄很污的视频网站| 久久久91精品国产一区二区| 日韩电影免费观看| 亚洲中文字幕无码av在线| 欧美疯狂做受xxxxx高潮| 人妻系列无码专区久久五月天| 精品无码国产自产拍在线观看蜜| 国产丰满老熟女重口对白| 国产香蕉一区二区精品视频| 国产精品成在线观看| 91麻豆爱豆果冻天美星空| 天堂а√在线地址中文在线| 一区二区三区免费精品视频 | 最强yin女系统白雪 | 亚洲人成77777在线播放网站| 欧美色视频日本| 亚洲综合久久久久久中文字幕| 百合h肉动漫无打码在线观看| 刘敏涛三级无删减版在线观看| 老太脱裤让老头玩ⅹxxxx| 国产一级做美女做受视频| 这里只有精品网| 国产人人为我我为人| 韩国r级2020年最新| 国产在线精品香蕉麻豆|