QA

IOTA^_^    

Sams Teach Yourself ASP.NET in 21 Days, Second Edition
By Chris Payne
Table of Contents
Day 5.  Beginning Web Forms


Q&A

Q1:

Does maintaining the viewstate slow down performance? Is there any way to turn it off?

A1:

Maintaining viewstate decreases performance very slightly, if at all. There's an additional step that ASP.NET must accomplish when maintaining viewstate. In performance-critical situations, you can disable viewstate with the following:

 EnableViewState=false 

You can set this property for any individual control, or for the page as a whole, in the <%@ Page %> directive.

Q2:

Some of the actions won't do anything on my Web form. What's wrong?

A2:

Don't forget to enclose all the controls for which you want to handle events in an HtmlForm control: <form runat="server">. (This is a common mistake.)

Also, make sure that you're using the correct syntax to declare the event handler:

 <asp:ControlName docEmphasis">name" runat="server"    OnEventName=eventHandler /> 

Finally, remember that events are handled in no particular order on the server. Occasionally, you may create an event handler that effectively stops another event from occurring.

For example, in the Page_Load event, you may clear the text from a TextBox. The method that handles the TextChanged event of the TextBox won't work properly because the Page_Load event has already cleared the text. In this case, check the IsPostBack property to make sure you aren't executing code that you don't need or don't want to execute.


    IOTA^_^    
    Top


    Sams Teach Yourself ASP. NET in 21 Days
    Sams Teach Yourself ASP.NET in 21 Days (2nd Edition)
    ISBN: 0672324458
    EAN: 2147483647
    Year: 2003
    Pages: 307
    Authors: Chris Payne

    Similar book on Amazon

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net