ASP.NETポップアップウィンドウ選択情報のいくつかの場合

11032 ワード

 ASP.NET ,            ,            ,     ,     。

上の図はラジオです.つまり、まずウィンドウをポップアップし、情報を選択してポップアップウィンドウを閉じ、元のページで必要なポップアップデータコントロールの内容を選択します.
 
上の図は、1つのウィンドウをポップアップして必要な情報を選択した後、ポップアップウィンドウの元のページを閉じずにポップアップウィンドウ情報を取得するコントロールの内容も変化します.
具体的なコードは以下の通りです.
元のページ:

/*  toid      ID,     ID,toname textbox,       。         ,     JAVASCRIPT  */
function group_select(toid,toname)
{
	var url= "../../../module/group_select/index.aspx?ToId="+toid+"&ToName="+toname; 
	var mwidth = "400";
	var mheight = "330";
	var loc_x,loc_y;  
	if(window.navigator.appName.toLowerCase().indexOf("netscape") > -1)
	{
		loc_x = parseInt((document.body.clientWidth - mwidth)/2) + 200;
		loc_y = parseInt((document.body.clientHeight - mheight)/2);	
		window.open(url,"group_select","left=" + loc_x + "px,top=" + loc_y + "px,width=" + mwidth + "px,height=" + mheight + "px,resizable=no,scrollbars=yes,status=0");
	}
	else
	{
		loc_x=document.body.scrollLeft+event.clientX-event.offsetX-100;
		loc_y=document.body.scrollTop+event.clientY-event.offsetY+170;
		window.showModalDialog(url,self,"edge:raised;scroll:1;status:0;help:0;resizable:1;dialogWidth:"+mwidth+"px;dialogHeight:"+mheight+"px;dialogTop:"+loc_y+"px;dialogLeft:"+loc_x+"px");
	}
}


ポップアップ・ページのラジオ・プライマリ・コード(ラジオ):


      
    
    
var parent_window;
if(window.navigator.appName.toLowerCase().indexOf("netscape") > -1)
	parent_window = window.parent.opener;
else
	parent_window = parent.dialogArguments;
    
    
function click_place(PartID,PartName)
{
    parent_window.document.getElementById("<% = PartID   %>").value = PartID;
    parent_window.document.getElementById("<% = PartName %>").value = PartName;
    returnValue="OK";
    window.close();/*      */
}

    


    
','');">
','');">
    (  )

             var privlist=new Array(); <%=strPrivList%></code></p> <p><code class="language-html">var parent_window; if(window.navigator.appName.toLowerCase().indexOf("netscape") > -1)  parent_window = window.opener; else  parent_window = window.dialogArguments;</code></p> <p><code class="language-html">function click_priv(priv_id) {   TO_VAL=parent_window.document.getElementById("<% =ViewState["ToId"] %>").value;   TO_NAME=parent_window.document.getElementById("<% =ViewState["ToName"] %>").value;   targetelement=document.getElementById("PRIV_"+priv_id);   priv_name=targetelement.getAttribute("name");</code></p> <p><code class="language-html">  if(TO_VAL.indexOf(","+priv_id+",")>0 || TO_VAL.indexOf(priv_id+",")==0)   {     if(TO_VAL.indexOf(priv_id+",")==0)          parent_window.document.getElementById("<% =ViewState["ToId"] %>").value=parent_window.document.getElementById("<% =ViewState["ToId"] %>").value.replace(priv_id+",","");         if(TO_VAL.indexOf(","+priv_id+",")>0)           parent_window.document.getElementById("<% =ViewState["ToId"] %>").value=parent_window.document.getElementById("<% =ViewState["ToId"] %>").value.replace(","+priv_id+",",",");               if(TO_NAME.indexOf(priv_name+",")==0)            parent_window.document.getElementById("<% =ViewState["ToName"] %>").value=parent_window.document.getElementById("<% =ViewState["ToName"] %>").value.replace(priv_name+",","");               if(TO_NAME.indexOf(","+priv_name+",")>0)        parent_window.document.getElementById("<% =ViewState["ToName"] %>").value=parent_window.document.getElementById("<% =ViewState["ToName"] %>").value.replace(","+priv_name+",",",");         borderize_off(targetelement);   }   else   {     parent_window.document.getElementById("<% =ViewState["ToId"] %>").value+=priv_id+",";     parent_window.document.getElementById("<% =ViewState["ToName"] %>").value+=priv_name+",";     borderize_on(targetelement);   } }</code></p> <p><code class="language-html">function borderize_on(targetelement) {  color="#003FBF";  targetelement.style.borderColor="black";  targetelement.style.backgroundColor=color;  targetelement.style.color="white";  targetelement.style.fontWeight="bold"; }</code></p> <p><code class="language-html">function borderize_off(targetelement) {   targetelement.style.backgroundColor="";   targetelement.style.borderColor="";   targetelement.style.color="";   targetelement.style.fontWeight=""; }</code></p> <p><code class="language-html">function begin_set() {   TO_VAL=parent_window.document.getElementById("<% =ViewState["ToId"] %>").value;    if(TO_VAL=="ALL_PRIV")   {      parent_window.document.getElementById("<% =ViewState["ToId"] %>").value="";      parent_window.document.getElementById("<% =ViewState["ToName"] %>").value="";   }  </code></p> <p><code class="language-html">  for (step_i=0; step_i<privlist.length; step_i++)   {   priv_id=privlist[step_i];      if(TO_VAL.indexOf(","+priv_id+",")>0 || TO_VAL.indexOf(priv_id+",")==0)   borderize_on(document.getElementById("PRIV_"+privlist[step_i]));   } }</code></p> <p><code class="language-html">function add_all() {   TO_VAL=parent_window.document.getElementById("<% =ViewState["ToId"] %>").value;   for (step_i=0; step_i<privlist.length; step_i++)   {     priv_id=privlist[step_i];     priv_name=document.getElementById("PRIV_"+privlist[step_i]).getAttribute("name");</code></p> <p><code class="language-html">    if(TO_VAL.indexOf(","+priv_id+",")<=0 && TO_VAL.indexOf(priv_id+",")!=0)     {         parent_window.document.getElementById("<% =ViewState["ToId"] %>").value+=priv_id+",";         parent_window.document.getElementById("<% =ViewState["ToName"] %>").value+=priv_name+",";         borderize_on(document.getElementById("PRIV_"+privlist[step_i]));     }   } }</code></p> <p><code class="language-html">function add_all_priv() {  parent_window.document.getElementById("<% =ViewState["ToId"] %>").value="ALL_PRIV";     parent_window.document.getElementById("<% =ViewState["ToName"] %>").value=" ";       parent.close(); }</code></p> <p><code class="language-html">function del_all() {    for (step_i=0; step_i<privlist.length; step_i++)   {   TO_VAL=parent_window.document.getElementById("<% =ViewState["ToId"] %>").value;  TO_NAME=parent_window.document.getElementById("<% =ViewState["ToName"] %>").value;       priv_id=privlist[step_i];     priv_name=document.getElementById("PRIV_"+privlist[step_i]).getAttribute("name");      if(TO_VAL.indexOf(priv_id+",")==0)     parent_window.document.getElementById("<% =ViewState["ToId"] %>").value=parent_window.document.getElementById("<% =ViewState["ToId"] %>").value.replace(priv_id+",","");       if(TO_VAL.indexOf(","+priv_id+",")>0)      parent_window.document.getElementById("<% =ViewState["ToId"] %>").value=parent_window.document.getElementById("<% =ViewState["ToId"] %>").value.replace(","+priv_id+",",",");             if(TO_NAME.indexOf(priv_name+",")==0)       parent_window.document.getElementById("<% =ViewState["ToName"] %>").value=parent_window.document.getElementById("<% =ViewState["ToName"] %>").value.replace(priv_name+",","");               if(TO_NAME.indexOf(","+priv_name+",")>0)        parent_window.document.getElementById("<% =ViewState["ToName"] %>").value=parent_window.document.getElementById("<% =ViewState["ToName"] %>").value.replace(","+priv_name+",",",");           borderize_off(document.getElementById("PRIV_"+privlist[step_i]));   } }</code></p> <p><code class="language-html">                                                       

      

private void LoadData()
        {
            string lit = "";
            Utilities.DBConnect db = new Utilities.DBConnect();

            DataTable dt = db.ExecuteDataTable("Select * from TMobileGroup order by GID");
            if (dt == null) { return; }
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string GID = dt.Rows[i]["GID"].ToString();
                string GName = dt.Rows[i]["GName"].ToString();
                strPrivList += "privlist[" + i.ToString() + "]=" + GID + ";\r
"; lit += "\r
"; lit += "" + GName + "\r
"; lit += "\r
"; } litPriv.Text = lit; }

これは OAの を にして られたものです. は で,あまり わない.