Prev | Current Page 297 | Next

Rob Cameron and Dale Michalk

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

Button;
else
return (ButtonDisplay) display;
}
set
{
ViewState["Display"] = value;
}
}
We also have a Text property that has an identical representation in the code to our previous
examples. It will appear as text on the surface of the button or as the text of the hyperlink.
The button-rendering code needs to have an if/then construct to switch the display based
on the enumeration value set by the developer/user. It also needs a way to submit the page
back to the web server when using the hyperlink display mode. The hyperlink is normally used
for navigation and is not wired into the postback mechanism that buttons get for free.
When updating the code from .NET Framework 1.1 server control to .NET Framework 2.0
and later, this warning message appeared:
'System.Web.UI.Page.GetPostBackClientHyperlink(System.Web.UI.Control, string)' is
obsolete: 'The recommended alternative is ClientScript.GetPostBackClientHyperlink.
Page.ClientScript.GetPostBackClientHyperlink is the replacement for System.Web.UI.
Page.GetPostBackClientHyperlink. The Page.ClientScript object is of type ClientScriptManager,
which is a new class introduced in ASP.NET 2.0 and later that defines methods for managing
client-side scripts in web applications.


Pages:
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309