简体   繁体   English

我如何在endrequest方法中的_dopostback()中传递参数?

[英]How do i get the parameter passed in _dopostback() in endrequest method?

How to I get the parameter value passed in 我如何获得传入的参数值

_dopostback('','');

For Example 例如
__doPostBack('<%=upSubAccount.ClientID %>',true);
I want to get the second parameter in endrequest() handler, here 我想在endrequest()处理程序中获取第二个参数,在这里

//wire the End Request process, //连接结束请求流程,

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(requestComplete_Handler)

    //will be called after the async request completes.
    function requestComplete_Handler(sender, args)
    {
        var panel = sender._postBackSettings.sourceElement.id;
        switch (panel)
        {
            case "<%=upSubAccount.ClientID %>":
                __doPostBack('<%=upAllocationChart.ClientID %>');
                break;
        }
    }

The second argument is the event argument. 第二个参数是事件参数。
It is not stored by the framework. 它不是由框架存储的。
However you can easily store it in a variable of your own and access it later. 但是,您可以轻松地将其存储在自己的变量中,以后再访问它。
You only need to replace the __doPostBack with your own function. 您只需要用自己的函数替换__doPostBack

var orignalDoPostback = __doPostBack;
var lastEventArgument = "";
__doPostBack = function(eventTarget, eventArgument)
{
   lastEventArgument = eventArgument;
   orignalDoPostback(eventTarget, eventArgument);
}

Then you can use it as required. 然后,您可以根据需要使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Application_EndRequest中获取RouteData - How do I get RouteData in Application_EndRequest 如果将其名称作为参数传递,如何在方法中打开表单 - How do I open a form in a method if passed its name as a parameter 如何获取作为 func 传递的匿名方法的参数值? - How can i get the parameter values of an anonymous method passed as a func? 如何获取传递给方法的参数的名称? - How to get the name of a parameter passed to a method? 如何在方法内部获取传递参数的nameof()? - How to get nameof() of the passed parameter inside of the method? 如何调用__doPostBack方法?调用方法在哪里? - how does the __doPostBack method get called? Where is the calling method? 当参数是模板时,如何调用作为方法 arguments 传递的对象的属性 - How do I call properties of objects passed as method arguments when the parameter is a template C#泛型如何获取没有对象类型作为参数的泛型方法的参数类型? - C# Generics How Can I get the type passed as an argument for a generic method with no object type as a parameter? 我如何从 aspx 网站 __doPostBack 表单中抓取数据? - How do i scrape data from an aspx site, __doPostBack form? 如何获取在传递参数的lambda中使用的方法名称 - How to get the method name used in lambda that was passed a parameter
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM