WebForm_PostBackOptions documentation [closed]

回眸只為那壹抹淺笑 提交于 2019-11-27 20:23:05

There is no official documentation on this. However if you look at the javascript source code you will see this:

function WebForm_PostBackOptions(eventTarget, eventArgument, validation, validationGroup, actionUrl, trackFocus, clientSubmit)

I think the parameter names are quite self-explanatory.

Look at the javascript decleration as Gh0sT said:

function WebForm_PostBackOptions(eventTarget, eventArgument, validation, validationGroup, actionUrl, trackFocus, clientSubmit)

Then look at the documentation for the server side PostBackOptions class you can get a clue what the parameters are: http://msdn.microsoft.com/en-us/library/system.web.ui.postbackoptions_members(v=VS.90).aspx

For most of the validation logic in asp.net the client side class try to mimic the server side.

I'm currently using ASP.NET 2.0 and the code in the page looks like this...

function WebForm_DoPostBackWithOptions(options) {
var validationResult = true;
if (options.validation) {
    if (typeof(Page_ClientValidate) == 'function') {
        validationResult = Page_ClientValidate(options.validationGroup);
    }
}
if (validationResult) {
    if ((typeof(options.actionUrl) != "undefined") && (options.actionUrl != null) && (options.actionUrl.length > 0)) {
        theForm.action = options.actionUrl;
    }
    if (options.trackFocus) {
        var lastFocus = theForm.elements["__LASTFOCUS"];
            if ((typeof(lastFocus) != "undefined") && (lastFocus != null)) {
                if (typeof(document.activeElement) == "undefined") {
                    lastFocus.value = options.eventTarget;
                }
                else {
                    var active = document.activeElement;
                    if ((typeof(active) != "undefined") && (active != null)) {
                        if ((typeof(active.id) != "undefined") && (active.id != null) && (active.id.length > 0)) {
                            lastFocus.value = active.id;
                        }
                        else if (typeof(active.name) != "undefined") {
                            lastFocus.value = active.name;
                        }
                    }
                }
            }
        }
    }
    if (options.clientSubmit) {
        __doPostBack(options.eventTarget, options.eventArgument);
    }
} 

Why are you stuck? Is the code just not appearing in the page? In ASP.NET 1.1 the file WebUIValidation.js had to exist on the disc in a specific directory (I forget which exactly). In 2.0 the script is integrated with the framework.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!