{infiniteZest}
// Articles. Tutorials. Utilities.
Home  |   Search  |   Login  
Categories Skip Navigation Links
New / All
AJAX
Apple
ASP.NET
.NET
Git
Google / Android
Python / IronPython
Miscellaneous
SQL Server
AJAX Source Viewer
View the source code of a Method from ASP.NET AJAX Library. Choose a method from the menu items above (Namespaces, Classes, or Methods).
Method '_onFormSubmitCompleted(sender, eventArgs)'
Method: _onFormSubmitCompleted(sender, eventArgs)
Method Full Name:     Sys$WebForms$PageRequestManager$_onFormSubmitCompleted(sender, eventArgs)
Class: PageRequestManager
Namespace: Sys.WebForms
Source File: MicrosoftAjaxWebForms.debug.js
1   function Sys$WebForms$PageRequestManager$_onFormSubmitCompleted(sender, eventArgs) {
2     this._processingRequest = true;
3     var delimitByLengthDelimiter = '|';
4     if (sender.get_timedOut()) {
5       this._endPostBack(this._createPageRequestManagerTimeoutError(), sender);
6       return;
7     }
8     if (sender.get_aborted()) {
9       this._endPostBack(null, sender);
10      return;
11    }
12    if (!this._request || sender.get_webRequest() !== this._request) {
13      return;
14    }
15    var errorMessage;
16    var delta = [];
17    if (sender.get_statusCode() !== 200) {
18      this._endPostBack(this._createPageRequestManagerServerError(sender.get_statusCode()), sender);
19      return;
20    }
21    var reply = sender.get_responseData();
22    var delimiterIndex, len, type, id, content;
23    var replyIndex = 0;
24    var parserErrorDetails = null;
25    while (replyIndex < reply.length) {
26      delimiterIndex = reply.indexOf(delimitByLengthDelimiter, replyIndex);
27      if (delimiterIndex === -1) {
28        parserErrorDetails = this._findText(reply, replyIndex);
29        break;
30      }
31      len = parseInt(reply.substring(replyIndex, delimiterIndex), 10);
32      if ((len % 1) !== 0) {
33        parserErrorDetails = this._findText(reply, replyIndex);
34        break;
35      }
36      replyIndex = delimiterIndex + 1;
37      delimiterIndex = reply.indexOf(delimitByLengthDelimiter, replyIndex);
38      if (delimiterIndex === -1) {
39        parserErrorDetails = this._findText(reply, replyIndex);
40        break;
41      }
42      type = reply.substring(replyIndex, delimiterIndex);
43      replyIndex = delimiterIndex + 1;
44      delimiterIndex = reply.indexOf(delimitByLengthDelimiter, replyIndex);
45      if (delimiterIndex === -1) {
46        parserErrorDetails = this._findText(reply, replyIndex);
47        break;
48      }
49      id = reply.substring(replyIndex, delimiterIndex);
50      replyIndex = delimiterIndex + 1;
51      if ((replyIndex + len) >= reply.length) {
52        parserErrorDetails = this._findText(reply, reply.length);
53        break;
54      }
55      content = reply.substr(replyIndex, len);
56      replyIndex += len;
57      if (reply.charAt(replyIndex) !== delimitByLengthDelimiter) {
58        parserErrorDetails = this._findText(reply, replyIndex);
59        break;
60      }
61      replyIndex++;
62      Array.add(delta, {type: type, id: id, content: content});
63    }
64    if (parserErrorDetails) {
65      this._endPostBack(this._createPageRequestManagerParserError(String.format(Sys.WebForms.Res.PRM_ParserErrorDetails, parserErrorDetails)), sender);
66      return;
67    }
68    var updatePanelNodes = [];
69    var hiddenFieldNodes = [];
70    var arrayDeclarationNodes = [];
71    var scriptBlockNodes = [];
72    var scriptStartupNodes = [];
73    var expandoNodes = [];
74    var onSubmitNodes = [];
75    var dataItemNodes = [];
76    var dataItemJsonNodes = [];
77    var scriptDisposeNodes = [];
78    var asyncPostBackControlIDsNode, postBackControlIDsNode,
79    updatePanelIDsNode, asyncPostBackTimeoutNode,
80    childUpdatePanelIDsNode, panelsToRefreshNode, formActionNode;
81    for (var i = 0; i < delta.length; i++) {
82      var deltaNode = delta[i];
83      switch (deltaNode.type) {
84        case "updatePanel":
85          Array.add(updatePanelNodes, deltaNode);
86          break;
87        case "hiddenField":
88          Array.add(hiddenFieldNodes, deltaNode);
89          break;
90        case "arrayDeclaration":
91          Array.add(arrayDeclarationNodes, deltaNode);
92          break;
93        case "scriptBlock":
94          Array.add(scriptBlockNodes, deltaNode);
95          break;
96        case "scriptStartupBlock":
97          Array.add(scriptStartupNodes, deltaNode);
98          break;
99        case "expando":
100         Array.add(expandoNodes, deltaNode);
101         break;
102       case "onSubmit":
103         Array.add(onSubmitNodes, deltaNode);
104         break;
105       case "asyncPostBackControlIDs":
106         asyncPostBackControlIDsNode = deltaNode;
107         break;
108       case "postBackControlIDs":
109         postBackControlIDsNode = deltaNode;
110         break;
111       case "updatePanelIDs":
112         updatePanelIDsNode = deltaNode;
113         break;
114       case "asyncPostBackTimeout":
115         asyncPostBackTimeoutNode = deltaNode;
116         break;
117       case "childUpdatePanelIDs":
118         childUpdatePanelIDsNode = deltaNode;
119         break;
120       case "panelsToRefreshIDs":
121         panelsToRefreshNode = deltaNode;
122         break;
123       case "formAction":
124         formActionNode = deltaNode;
125         break;
126       case "dataItem":
127         Array.add(dataItemNodes, deltaNode);
128         break;
129       case "dataItemJson":
130         Array.add(dataItemJsonNodes, deltaNode);
131         break;
132       case "scriptDispose":
133         Array.add(scriptDisposeNodes, deltaNode);
134         break;
135       case "pageRedirect":
136         if (Sys.Browser.agent === Sys.Browser.InternetExplorer) {
137           var anchor = document.createElement("a");
138           anchor.style.display = 'none';
139           anchor.attachEvent("onclick", cancelBubble);
140           anchor.href = deltaNode.content;
141           document.body.appendChild(anchor);
142           anchor.click();
143           anchor.detachEvent("onclick", cancelBubble);
144           document.body.removeChild(anchor);
145           
146           function cancelBubble(e) {
147             e.cancelBubble = true;
148           }
149         }
150         else {
151           window.location.href = deltaNode.content;
152         }
153         return;
154       case "error":
155         this._endPostBack(this._createPageRequestManagerServerError(Number.parseInvariant(deltaNode.id), deltaNode.content), sender);
156         return;
157       case "pageTitle":
158         document.title = deltaNode.content;
159         break;
160       case "focus":
161         this._controlIDToFocus = deltaNode.content;
162         break;
163       default:
164         this._endPostBack(this._createPageRequestManagerParserError(String.format(Sys.WebForms.Res.PRM_UnknownToken, deltaNode.type)), sender);
165         return;
166       }
167     }
168     var i;
169     if (asyncPostBackControlIDsNode && postBackControlIDsNode &&
170     updatePanelIDsNode && panelsToRefreshNode &&
171     asyncPostBackTimeoutNode && childUpdatePanelIDsNode) {
172       this._oldUpdatePanelIDs = this._updatePanelIDs;
173       var childUpdatePanelIDsString = childUpdatePanelIDsNode.content;
174       this._childUpdatePanelIDs = childUpdatePanelIDsString.length ? childUpdatePanelIDsString.split(',') : [];
175       var asyncPostBackControlIDsArray = this._splitNodeIntoArray(asyncPostBackControlIDsNode);
176       var postBackControlIDsArray = this._splitNodeIntoArray(postBackControlIDsNode);
177       var updatePanelIDsArray = this._splitNodeIntoArray(updatePanelIDsNode);
178       this._panelsToRefreshIDs = this._splitNodeIntoArray(panelsToRefreshNode);
179       for (i = 0; i < this._panelsToRefreshIDs.length; i++) {
180         var panelClientID = this._uniqueIDToClientID(this._panelsToRefreshIDs[i]);
181         if (!document.getElementById(panelClientID)) {
182           this._endPostBack(Error.invalidOperation(String.format(Sys.WebForms.Res.PRM_MissingPanel, panelClientID)), sender);
183           return;
184         }
185       }
186       var asyncPostBackTimeout = asyncPostBackTimeoutNode.content;
187       this._updateControls(updatePanelIDsArray, asyncPostBackControlIDsArray, postBackControlIDsArray, asyncPostBackTimeout);
188     }
189     this._dataItems = {};
190     for (i = 0; i < dataItemNodes.length; i++) {
191       var dataItemNode = dataItemNodes[i];
192       this._dataItems[dataItemNode.id] = dataItemNode.content;
193     }
194     for (i = 0; i < dataItemJsonNodes.length; i++) {
195       var dataItemJsonNode = dataItemJsonNodes[i];
196       this._dataItems[dataItemJsonNode.id] = Sys.Serialization.JavaScriptSerializer.deserialize(dataItemJsonNode.content);
197     }
198     var handler = this._get_eventHandlerList().getHandler("pageLoading");
199     if (handler) {
200       handler(this, this._getPageLoadingEventArgs());
201     }
202     if (formActionNode) {
203       this._form.action = formActionNode.content;
204     }
205     
206     
207     Sys._ScriptLoader.readLoadedScripts();
208     Sys.Application.beginCreateComponents();
209     var scriptLoader = Sys._ScriptLoader.getInstance();
210     this._queueScripts(scriptLoader, scriptBlockNodes, true, false);
211     
212     this._updateContext = {
213       response: sender,
214       updatePanelNodes: updatePanelNodes,
215       scriptBlockNodes: scriptBlockNodes,
216       scriptDisposeNodes: scriptDisposeNodes,
217       hiddenFieldNodes: hiddenFieldNodes,
218       arrayDeclarationNodes: arrayDeclarationNodes,
219       expandoNodes: expandoNodes,
220       scriptStartupNodes: scriptStartupNodes,
221       onSubmitNodes: onSubmitNodes
222       };
223     scriptLoader.loadScripts(0,
224     Function.createDelegate(this, this._scriptIncludesLoadComplete),
225     Function.createDelegate(this, this._scriptIncludesLoadFailed),
226     null);
227   }
This is the JavaScript source for method _onFormSubmitCompleted(sender, eventArgs) from ASP.NET AJAX Library. Full name for this method is Sys$WebForms$PageRequestManager$_onFormSubmitCompleted(sender, eventArgs). It belongs to the class PageRequestManager, which is in Sys.WebForms namespace. This source is in MicrosoftAjaxWebForms.debug.js file.
Bookmark and Share This
About  Contact  Privacy Policy  Site Map