Prev | Current Page 314 | Next

Rob Cameron and Dale Michalk

"Pro ASP.NET 3.5 Server Controls and AJAX Components"

aspnetForm;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
// -->

224 CHAPTER 5 ?–  SE RVER CONTROL EVENTS
The JavaScript code programmatically submits the form and sets two hidden variables to
give ASP.NET enough information about what control was responsible for causing the postback.
It doesn??™t need this extra step when rendering the button, but the
step is mandatory for hyperlinks. You can also see that the purpose of the second parameter in
Page.ClientScript.GetPostBackClientHyperlink is to pass an eventArgument, which makes its
way back to the RaisePostBack method invocation on the server-side control implementation
as the string parameter named argument.
Composing the SuperButton Control into a
Composite Pager Control
Our SuperButton control is capable of raising command events through the event-bubbling
mechanism. To capture these bubbled events, we use a composite control named Pager. Pager
recognizes bubbled command events from its children and raises a PageCommand event to its
event clients.


Pages:
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326