zoukankan      html  css  js  c++  java
  • 用JavaScript执行PostBack

    早上实现了在子页面更新数据以后,父页面刷新树的功能

    思路:

    • 父页面有个隐藏的html button作为proxy,子页面保存完数据以后,用js调用父页面的html button的触发函数click();
    • 父页面有个asp.net的link button控件,text="",等于也是隐藏的,它负责调用后台cs代码里的负责刷新树的方法;
    • 父页面的html button onclick的时候,__doPostBack('DoRefresh','');

    代码:

    父页面apsx:
    <input type="button" id="DoRefreshProxy" value="DO" onclick="__doPostBack('DoRefresh','');" style="display:none;" />
    <asp:linkbutton id="DoRefresh" runat="server" onclick="DoRefresh_Click"  CausesValidation=False/>
    父页面cs:
    protected void DoRefresh_Click(object sender, EventArgs e)
    {
    this.BindTree(this.tvBuilding.SelectedNodeIndex,1);
    }
    子页面cs:
    Page.RegisterStartupScript("pb","<script>window.opener.document.getElementById('DoRefreshProxy').click();</script>");
  • 相关阅读:
    linux安装jenkins
    如何将接口进行限流
    java线程池思想
    一次缓存评估过程
    docker
    linux基本操作
    【安卓】App自动化环境搭建
    sheill之文本处理工具
    Liunx vim编辑器
    Liunx 远程
  • 原文地址:https://www.cnblogs.com/jinweijie/p/567812.html
Copyright © 2011-2022 走看看