views:

4385

answers:

3

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

+6  A: 

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.

Gh0sT
A: 

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
A: 

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