How to Construct a Reusable Silverlight ASP.NET User Control
The ASP.NET User Control
User controls generally are created when there is a need for reusable content. A corporate logo is an item that could conceivably be used numerous times throughout the course of an application. Additionally, if the need arises to use a control across applications, the user control's sibling, the custom control, may be a more appropriate alternative. Reusability is recursively responsible.
The ASP.NET markup code for the corporate logo user control is defined below. In this specific instance, the code-behind has been intentionally omitted. However, that is because there is no procedural code to mention. At the end of this article, you will find a zip file containing the source code for this example. Please examine the code for yourself.
- Assigning the "id" attribute of the hosting DIV element
- Referencing the hosting DIV element within the instantiation of the Silverlight control
- Defining the ID of the Silverlight control
This is important because it ensures unique references of the Silverlight content. To illustrate why this is needed, envision creating a web page that requires the use of the corporate logo multiple times. Without the unique names, there would be no way to distinguish between the various instances of the logo.
At this point, a very basic user control that utilizes Silverlight has been constructed. This user control demonstrated how to integrate Silverlight content with a web application. It also demonstrated how one can leverage an existing skillset to harness the power of a new technology.
Silverlight provides new avenues for building lasting connections with users. It's important to grow these connections with minimal effort. With Silverlight, it's easy to strengthen your brand leveraging your existing web applications.
Download the Code
Download the zip file that contains all the code for this article here.
About the Author
|Chad Campbell (MCSD, MCTS) is a solutions developer for mid- to large-sized organizations. He is a thought leader with Crowe Chizek in Indianapolis, Indiana. Chad specializes in Web-based solutions, Reach him at firstname.lastname@example.org.|
Page 2 of 2