39

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

Mauricio Scheffer
  • 98,863
  • 23
  • 192
  • 275
Craig
  • 36,306
  • 34
  • 114
  • 197

3 Answers3

51

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.

Daniel P
  • 3,314
  • 1
  • 36
  • 38
15

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.

Shrage Smilowitz
  • 24,494
  • 2
  • 28
  • 32
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.

Sam R
  • 415
  • 3
  • 10