ie窗口之间的无刷新传参数,c#后台代码调用前台js代码

父窗口的超链接:
<a href="#" οnclick="getProductType('tb_category');">选择分类</a>
tb_category:为要接受子窗口参数的父窗口textbox

< script language = " javascript "  type = " text/javascript " >
 
        
function  getProductType(c)
        
{
            
var win;
            
var sWidth  = screen.availWidth;
            
var sHeight = screen.availHeight;
            
var l = sWidth / 2 - 400;
            
var t = sHeight / 2 - 556;

            win 
=window.open("B2C_Orders_NewOrderProductList.aspx?sourceC=" + c,"B2C_Orders_NewOrderProductList","height=400, width=556, top=" + t + ", left=" + l + ", toolbar=no, menubar=no, scrollbars=yes, resizable=yes,location=no, status=no");
            win.focus();
        }

    
</ script >
子窗口aspx代码:
<% @ Page Language="C#" AutoEventWireup="true" CodeFile="B2C_Orders_NewOrderProductList.aspx.cs" Inherits="system_B2C_Orders_NewOrderProductList"  %>

< html  xmlns ="http://www.w3.org/1999/xhtml"   >
< head  runat ="server" >
    
< title > 商品分类选择 </ title >
    
< link  href ="css/sub.css"  rel ="stylesheet"  type ="text/css"   />
    
< script  language ="javascript"  type ="text/javascript" >
        
function returnResult(v,c)
        
{
           
var openerC = opener.document.getElementById(c);
            //var openerC = window.opener.docInforFrame.document.getElementById(c);
            
if(openerC != null)
            
{
                openerC.value 
= v;
            }

            
else
            
{
                openerC.value 
= "分类提取失败!";
            }

            
            window.close();
        }

    
</ script >
</ head >
< body >
    
< form  id ="form1"  runat ="server" >
        
< asp:TreeView  ID ="trv_categoryTree"  runat ="server"  ImageSet ="WindowsHelp" >
                            
< ParentNodeStyle  Font-Bold ="False"   />
                            
< HoverNodeStyle  Font-Underline ="True"  ForeColor ="#6666AA"   />
                            
< SelectedNodeStyle  BackColor ="#B5B5B5"  Font-Underline ="False"  HorizontalPadding ="0px"
                                VerticalPadding
="0px"   />
                            
< NodeStyle  Font-Names ="Tahoma"  Font-Size ="8pt"  ForeColor ="Black"  HorizontalPadding ="5px"
                                NodeSpacing
="0px"  VerticalPadding ="1px"   />
                        
</ asp:TreeView >
    
    
</ form >
</ body >
</ html >
父窗口cs代码:
using  System;
using  System.Data;
using  System.Configuration;
using  System.Collections;
using  System.Web;
using  System.Web.Security;
using  System.Web.UI;
using  System.Web.UI.WebControls;
using  System.Web.UI.WebControls.WebParts;
using  System.Web.UI.HtmlControls;

public   partial   class  system_B2C_Orders_NewOrderProductList : System.Web.UI.Page
{
    
protected void Page_Load(object sender, EventArgs e)
    
{
        
if (!Page.IsPostBack)
        
{
            
if (Request.QueryString["sourceC"!= null)
            
{
                Session[
"SE_system_B2C_Orders_NewOrderProductList"= Request.QueryString["sourceC"].Trim();
            }

            
if (Request.QueryString["CatId"== null)
            
{
                B2C_CategoryTree categoryTree 
= new B2C_CategoryTree();
                
//生成树
                categoryTree.GetMerchCatTreeForType(this.trv_categoryTree, sql_b2c.sql305, "B2C_Orders_NewOrderProductList.aspx", Server);
            }

            
else
            
{
                
//returnResult
                ScriptManager.RegisterStartupScript(Page, typeof(system_B2C_Orders_NewOrderProductList), """returnResult('" + Request.QueryString["CatId"].Trim() + "','" + Session["SE_system_B2C_Orders_NewOrderProductList"].ToString().Trim() + "');"true);
            }

        }

    }

}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值