lhgdialogV2.37 使用

/Files/tiger8000/lhgdialogV2.37完整版.rar

 

parent.aspx 父页面:

 

 <script src="../lhgdialog/lhgcore.min.js" type="text/javascript"></script>
 <script src="../lhgdialog/lhgdialog.js" type="text/javascript"></script>

<script type="text/javascript" language="javascript">        
    
     function opdlg2(weburl)
        {
            J.dialog.get( 'test2', { page: weburl,width:780,height:400,title:'部门添加车辆信息', cover: false, range: true,foot: false } );
        }                 
</script>

<body>
    <form id="form1" runat="server">

<table>

<tr>

  <td  align="center" width="100">
                                              <a  style="cursor:hand"  onclick="opdlg2('../AdminCenter/SendMonthReporter.aspx?id=<%#Eval("ID")%>&type=<%#Eval("ID")%>')">上报油耗</a>
                                            </td>

</tr>

</table>

    </form>
</body>
</html>

如果是 gridview ,则要在 .CS 中

 

 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Attributes.Add("onmouseover", "if(this!=prevselitem){this.style.backgroundColor='#D2E9FF'}");//当鼠标停留时更改背景色
                e.Row.Attributes.Add("onmouseout", "if(this!=prevselitem){this.style.backgroundColor='#ECF5FF'}");//当鼠标移开时还原背景色
                e.Row.Attributes.Add("onclick", e.Row.ClientID.ToString() + ".checked=true;selectx(this)");
                e.Row.Attributes.Add("ondblclick", "opdlg22(" + e.Row.Cells[1].Text + ")");
            }
        }

 

实现弹出窗口:e.Row.Attributes.Add("ondblclick", "opdlg22(" + e.Row.Cells[1].Text + ")");

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

 

然后,弹出的子页:Child.aspx

 

关闭窗口代码:

<script type="text/javascript">
      var P = window.parent, E = P.setDialog();
      function closdlg()
      {
         //E.location.reload();  //此句为关闭此子窗口同时刷新父窗口
         //E.location.href="ListData.aspx"; //此句为关闭此子窗口同时父窗口跳转到  ListData.aspx 页面
         P.cancel();
      }
 </script>

 

法一、在 html 中直接关闭

 <td>
            <asp:Button ID="Button2" runat="server" Text="取消" OnClientClick="closdlg()"
                    Width="75px" />
              </td>

 

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

法二、在Button1 的 CS 代码中关闭:

 protected void Button1_Click(object sender, EventArgs e)
        {
            ClientScript.RegisterStartupScript(GetType(), "alert", "closdlg();alert('数据上传成功!');", true);
        }

 

 

你可能感兴趣的:(dialog)