Deployment and Customization
The deployment of this application is straightforward. First, copy all the Web files into a folder in the Web root directory. Next, attach a copy of the SQL database to the database server you wish to access. Finally, change the ConnectionString in the appSettings section of the web.config file to one that will allow access to the database.
This application has a lot of potential for further customizations. Adding a multiuser scheduling feature that would allow a best time/date to be automatically
In this chapter, you've learned how to build an entire scheduling application. One of the main things we touched on was databinding to a control with custom databinding. This application also uses SQL Server effectively by accessing stored procedures.
After reading this chapter, you should be able to write custom controls that are derived from the standard ASP.NET server controls. This will give you flexibility as you design and write your own controls based on the standard controls.
Chapter 6. The Microsoft Forum Application
In This Chapter:
Microsoft went the extra mile to provide some great applications that are examples of how to get the most out of the .NET Framework, and
The Microsoft Forum application is
Figure 6.1. The ASP.NET Forum Application Offers a Fantastic Way for Users to Communicate.
Using Embedded Server Controls in Iterative Databound Controls
In this section, I'll show you how to get more functionality from iterative databound controls such as Repeaters, DataLists, and DataGrids. With the extra functionality comes a richer user interface, which will ultimately yield a better application. Applications that have smooth
To pull this enhancement off, server controls such as Labels, CheckBoxes, and DropDownLists can be embedded into iterative databound controls. Getting access to the embedded controls is easy, thus making the iterative databound controls very flexible.
The scenario is this: You've convinced your boss to let you develop the
OK; so three weeks have passed, and your boss comes by to see the work in progress. One of the pages has a Repeater object that's been bound to a recordset that was retrieved from the database. The application looks great, and he's really impressed with the small amount of code it took to get the result. He asks for a change, though. You need to be able to select each row with a checkbox so that users can select any number of items for processing.
You get busy and scour the Repeater documentation. There must be something about checkboxes. But hours of research are fruitless, and you throw up your hands in despair. Maybe a Repeater wasn't the object type you should have used. You take a look at the DataList and DataGrid objects, hoping to find the solution, but no such luck. No checkboxes are built into the iterative databound controls.
Hold on, though; there is hope. Server controls such as CheckBoxes, Labels, and TextBoxes can all be embedded within ASP.NET iterative databound controls. With the right approach, the Repeater in the already-developed ASP.NET application can be easily changed to give users the capability to select the items in the list. This section talks about embedding server controls in iterative databound controls, and shows some example programs that'll help you understand.
ASP.NET iterative databound controls give you an easy way to display lists of data from a data source. They also offer flexibility because you can add server controls such as Labels and CheckBoxes to the declarative constructs, such as ItemTemplates, that go in the .aspx file. The section is broken into three
For each demo, I'll talk about the declaration of the objects that reside in the .aspx file. This declaration includes things such as ItemTemplates and Columns.
For each demo, I'll also go through the code that's behind it. We'll rely heavily on the FindControl() method. This method obtains object references to the server controls that we want to access.
All code snippets are presented in C# and VB. The complete demo project can be downloaded as either a C# or a VB project.