How to pass a parameter to a user control?
Create a User Control Below Code goes in User Control <asp:ImageButton id=’ImageButton1′ runat=’server’></asp:ImageButton> Create a property called source VB.NET Public Property source() As String Get Return ImageButton1.ImageUrl End Get Set(ByVal Value As String) ImageButton1.ImageUrl = Value End Set End Property C# public string source { get { return ImageButton1.ImageUrl; } set { ImageButton1.ImageUrl = value; } } Now in your webform: Drag and drop User Control and set the source property. <uc1:UCImageButton source=’b2346.jpg’ id=’UCImageButton1′ runat=’server’></uc1:UCImageButton>
Are there any settings on the application level to make certain elements appear on every page without having to manually insert code or insert UserControls?
You can use HttpHandlers and/or HttpModules to insert information on all pages transparently. Check out Bipin Joshi’s article Extending ASP.NET with HttpHandlers and HttpModules
How can I include an Asp.NET page in many other Asp.Net pages so that I don’t need to rewrite the code?
One of the approaches is to write and use a UserControl. You can define the user interface, handle events and expose properties in a UserControl, and then mark a reference and reuse these Controls in any page of your Web application. Here is some Sample code
Is there anything similar to web templates in ASP that I can use in ASP.Net?
In ASP.NET, you would typically use a User Control to create reusable controls.
How can I set the Selection of the Calendar Control to date or week or month
Set the SelectionMode =DayWeekMonth You can set it to any of the following: Day DayWeek DayWeekMonth None