ASP.NET AdRotator Control

ASP.NET Adrotator Control displays images in a sequence mode, and this Control can be used for Advertisement elements. ASP.NET AdRotator Control stores the Advertisement’s information in an XML file.

The following code snippet shows how to initiate the XML file.

<Advertisements>
<Ad>
<ImageUrl>/banners/ad1.gif</ImageUrl>
<NavigateUrl>http://www.aspnetbook.com</NavigateUrl>
<AlternateText>Main Site</AlternateText>
<Impressions>10</Impressions>
<Keyword>Keywords Here</Keyword>
</Ad>
</Advertisements>

Within these tags there can be many <Ad></Ad> tags, these are used to define different advertisements

Here is a quick tutorial on how to add your very own ASP.NET Adrotator Control to your .aspx page.

  1. Go to the Toolbox and under the Standard section, select AdRotator Control.

ASP.NET AdRotator Control
ASP.NET AdRotator Control

  1. Drag and drop it onto the Form area to declare it.
  2. The following is the code excerpt you get in the Source View.

<asp:AdRotator ID=”AdRotator1″ runat=”server” />

For more on how to use ASP.NET Adrotator Control check out the examples at www.aspnetbook.com

Posted in ASP.NET Tutorial | Tagged , , , , , | Leave a comment

ASP.NET Control Standard Properties

When you use ASP.NET as the programming language for developing your web site, you are provided with some standard ASP.NET Control Properties. These ASP.NET Control standard properties are inherited from the Control class.

The following table shows the available ASP.NET Control standard properties together with a brief description and the .NET framework which it supports.

PropertyDescription.NET
AppRelativeTemplateSourceDirectoryGets or sets the application-relative virtual directory of the Page or UserControl object that contains this control.1.0
BindingContainerThe control that contains this control’s data binding1.0
ClientIDThe server control id created by ASP.NET.1.0
ControlsGets a ControlCollection object that represents the child controls for a specified server control in the UI hierarchy.1.0
EnableThemingA value indicating whether or not themes apply to the control1.0
EnableViewStateA value indicating whether or not the control persists its view state, and the view state of any child controls it contains, to the requesting client.1,0
IDThe id assigned to the control2.0
NamingContainerA reference to the server control’s naming container1.0
PageA reference to the page that contains the control1.0
ParentA reference to the control’s parent2.0
SiteInformation about the container of the current control (Get value only)2.0
TemplateControlA reference to the template that contains the current control1.0
TemplateSourceDirectoryThe virtual directory of the page/control that contains the current control1.0
UniqueIDThe unique id for the server control (Get value only)1.0
VisibleA value indicating whether a control is rendered as UI1.0
Posted in ASP.NET 4 Theory | Tagged , , , , , | Leave a comment

ASP.NET Web Control Standard Properties

When you use ASP.NET as the programming language for developing your web site, you are provided with some standard ASP.NET Web Control Properties. These ASP.NET Web Control Standard Properties are inherited from the “WebControl” class.

The following table shows the available ASP.NET Web Control Standard Properties together with a brief description and the .NET framework which it supports.

PropertyDescription.NET
AccessKeyThe keyboard key for accessing a control1.0
AttributesThe collection of attributes applied to a control1.0
BackColorThe background color of a control1.0
BorderColorThe border color of a control1.0
BorderStyleThe border style of a control1.0
BorderWidthThe border width of a control1.0
CssClassThe CSS class applied to a control1.0
EnabledA value indicating whether or not control is enabled1.0
FontThe font attributes for the control1,0
EnableThemingWhether or not themes apply for a control2.0
ForeColorThe foreground color of the control1.0
HeightThe height of the control1.0
IsEnabledA value indicating whether or not control is enabled (Get value only)2.0
SkinIDThe skin of the control2.0
StyleThe inline CSS style of the control1.0
TabIndexThe tab order of the control1.0
ToolTipThe text that appears when the user rests the mouse pointer over a control1.0
WidthThe width of the control1.0
Posted in ASP.NET 4 Theory | Tagged , , , , , | Leave a comment

ASP.NET Directory Structure

When using ASP.NET to create web application, you have an ASP.NET directory structre which can be determined byyou the developer’s choices. There are a few reserved directory names which cannot be used but a site can have as much as directories as required.

The ASP.NET Directory structure is typically reflected directly in the URL, and even though ASP.NET provides a way to intercept the request at a point during web page processing, it is not forced to funnel requests through a central application or front controller.

The following are some of the Special ASP.NET Directory names available in ASP.NET:

App_Code

Is the directory used for any code used in the ASP.NET web application. The ASP.NET server will automatically compile these files and any subdirectorues within the App_Code folder into an assembly which can be then accessed by the code in any page of the ASP.NET website.

The App_Code will be used for:

  • Data access abstraction code
  • Model code
  • Business code
  • Any site specific http handlers and modules
  • Any Web service implementations

Note:

  • An alternative to using App_Code the developer may opt to provide a separate assembly with pre-compiled code.

App_Data

The App_Data ASP.NET Directory is the default directory for any database used by the ASP.NET Website. These databases might include Access (mdb) files or SQL Server (mdf) files. The App_Data is the only directory with Write Access enabled for the ASP.NET web application.

App_LocalResources

The ASP.NET App_LocalResources Directory holds any localized resources used by the ASP.NET web application. These may includes different version of the same page for instance a page with the same content but in two different languages.

App_GlobalResources

The ASP.NET App_GlobalResources Directory is used to hold any “resx” files with localized resources which can be used at any ASP.NET web page in the web site. The ASP.NET App_Global Resources folder is where the ASP.NET developer uses to store any localized messages which might be used on more than one ASP.NET web page.

App_Themes

The ASP.NET App_Themes Directory is used to contain any files related to ASP.NET themes which is a new ASP.NET feature from ASP.NET 2.0.  ASP.NET themes can be used to make a consistent appearance through out the whole ASP.NET Website and makes it easier to change the appearance of the website.

App_WebReferences

The ASP.NET App_WebReferences is used to contain any discovery files and WSDL files for references to Web services to be used in the ASP.NET website.

Bin

The ASP.NET Bin Directory is used to hold any compiled code (.dll files). These compiled code can be used as  reference in your application for

  • Controls
  • Components
  • Other codes of you application

Any classes represented by code in the Bin folder are automatically referenced in your application.

Posted in ASP.NET Tutorial | Tagged , , , , , , , , , , | Leave a comment

Running an ASP.NET Page

In this ASP.NET tutorial you will learn how to run an ASP.NET page using Visual Studio 2010. You should learn how to run an ASP.NET page before you learn any further details on ASP.NET 4 programming like adding controls to a page etc.

The first thing you need in order to run an ASP.NET page which is an .aspx file, is a Web Server. When you create a production website, you will always use Internet Information Services also known as IIS as your web server. But for just testing an ASP.NET page, you can use the ASP.NET Development Server. The ASP.NET Development Server runs on the Local machine and does not require the IIS web server.

Note:

  • When you create file system web sites, the default Web Server in Visual Web Developer is the ASP.NET Development Server.

The following is a step by step ASP.NET tutorial on how to run an ASP.NET page (.aspx page) on your local PC.

  1. From the Solution Explorer, select the ASP.NET page (here it is Default.aspx).
  2. Right Click on Default.aspx ASP.NET page and Select the “Set As Start Page”.

 Setting ASP.NET Start Page

  1. Go to the Standard Toolbar and then select the Run button (Start Debugging button).

ASP.NET Start Debugging button

  1. As this is the First time you are running your ASP.NET page, the Debugging is not Enabled. So on press of the Start Debugging button, a dialog box appears asking whether to Create a new Web.config file with debugging enabled or run without debugging.

Debugging Not Enabled create web.config

Note:

  • If you choose to Create a Web.config file for the first time, it will also ask you to Update the Web.config file when you run it for the second time.
  • Running without Debugging is the same as pressing Ctrl + F5
  • Visual Web Developer starts the ASP.NET Development Server. An icon appears on the toolbar to indicate that the Visual Web Developer Web server is running. Visual Web Developer Web server icon
  1. The ASP.NET page will be displayed in the browser. Even thought the ASP.NET page you created has an extension of .aspx, it currently runs like any .HTML page.
  2. After you are done, you can close the Web browser.
Posted in ASP.NET Tutorial | Tagged , , , | Leave a comment