Top 4 Tips on working with ASP.NET Controls

Leave a Comment

The following list presents some practical tips on working with controls:

#Tips 1. Spend some time trying out the different controls in the Standard category. Although many of them are used and discussed throughout the book, it’s good to know how you should use them and how they operate. By experimenting with them now in a few sample pages, you have a head start when the controls reappear in later chapters.

#Tips 2. Consider turning off View State for controls that don’t need it. In many cases, you hardly notice the difference, but especially with the data-driven controls, disabling View State can seriously decrease the size of your web page, resulting in shorter load times and improved user experience.

#Tips 3. Before you design a complex Web Form with multiple controls to accept user input, step back from your computer and take a piece of paper and a pen to draw out the required functionality. By thinking about the (technical) design of your application before you start coding, it’s much easier to create a consistent and well-thought-out user interface. Making considerable changes later in the page if you have taken a wrong route will always take more time than doing it (almost) right the first time.

#Tips 4. Experiment with the View State mechanism to get a better understanding of how it works. Create a couple of pages similar to the one you created in the last exercise. Then turn off View State at the page or control level and see how the page behaves. Take note of the controls, such as TextBox, that are capable of maintaining their value even with View State off.

0 comments:

Post a Comment