WebForm_PostBackOptions documentation

Is there any documentation on the parameters to WebForm_PostBackOptions? I can’t find anything by Googling.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

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.

Method 2

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.

Method 3

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.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x