ASP.NET中用JS弹出模态对话框后在里面的分页的问题!

下面是我打开模态对话框的JS函数:

  <script language="javascript">  
               function OpenWin(){  
                var str=window.showModalDialog('selorder.aspx','','dialogLeft=80px;dialogTop=80px;dialogWidth=650px;dialogHeight=450px');  
               if(str!=null)    
                 document.getElementById("ctl00_ContentPlaceHolder1_txtPayMoney").value = str;  
                }  
 </script>  

 下面是selorder.aspx页面的主要代码:

<asp:GridView ID="gdvOrders" runat="server" AutoGenerateColumns="False"   
             CssClass="mconttable" PageSize="5">  
       ...  
            </asp:GridView>  
           <br />  
           <webdiyer:AspNetPager PageSize="5" ID="anpOrderByLocId" runat="server" FirstPageText='首'  
           LastPageText='尾' CssClass="pageindexlink" CurrentPageButtonClass="aaa" CustomInfoClass=""  
           PagingButtonSpacing="" OnPageChanged="anpOrderByLocId_PageChanged">  
        </webdiyer:AspNetPager>  
            <br />  
 <input type='button' name='bb' id='bb' style="width:80px" value='选择' runat="server" />  

 下面是selorder.aspx.cs页面的主要代码:

protected void Page_Load(object sender, EventArgs e)  
 {  
     if (!Page.IsPostBack)  
         {  
             // 通过登陆的用户名获取公司ID  
            DataTable dt = OrderDAO.SearchLocByUserName(Profile.UserName);  
            int locid = int.Parse(dt.Rows[0]["Id"].ToString());  // 公司ID  
            ViewState["locid"] = locid;  
     
            anpOrderByLocId.RecordCount = OrderDAO.QueryOrderCount("CoLocId=" + locid);  
   
           BindDataOrderByLocId(locid);  
    
          bb.Attributes.Add("onclick", "window.parent.returnValue=76.78;window.close();");  
       }  
    }  
    
   // 绑定订单数据,用于默认查询  
    private void BindDataOrderByLocId(int locid)  
    {  
       int startIndex = anpOrderByLocId.StartRecordIndex;  
       int endIndex = anpOrderByLocId.EndRecordIndex;  
    
        gdvOrders.DataSource = OrderDAO.QueryOrderByLocId(locid, startIndex, endIndex);  
        gdvOrders.DataBind();  
   }  
    
 
   // 默认查询换页  
    protected void anpOrderByLocId_PageChanged(object sender, EventArgs e)  
   {  
       BindDataOrderByLocId(int.Parse(ViewState["locid"].ToString()));  
  }  

 可是我在弹出的模态对话框内点击换页的按键的时候就换不了页,不知道怎么回事,但是单独运行selorder.aspx是可以分页的.

  解决方法:
   得在selorder.aspx的head部分加入些代码,下面是head的代码:

<head runat="server">  
    <title>选择订单</title>  
   <!-- 防止重新打开页面形式的对话框 -->  
     <base target="_self" />   
   </head>  

 

你可能感兴趣的:(JavaScript,.net,asp.net,asp)