0% found this document useful (0 votes)
21 views8 pages

AWd Unit 2

The document discusses various ASP.NET controls including ListBox, DropDownList, AdRotator, Calendar, and SiteMapPath, highlighting their properties and functionalities. It explains the structure and usage of the AdRotator control for displaying advertisements, the Calendar control for date selection, and the SiteMapPath for navigation. Additionally, it outlines different types of ASP.NET files and the Page class, detailing their roles in web application development.

Uploaded by

jy193857.yadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views8 pages

AWd Unit 2

The document discusses various ASP.NET controls including ListBox, DropDownList, AdRotator, Calendar, and SiteMapPath, highlighting their properties and functionalities. It explains the structure and usage of the AdRotator control for displaying advertisements, the Calendar control for date selection, and the SiteMapPath for navigation. Additionally, it outlines different types of ASP.NET files and the Page class, detailing their roles in web application development.

Uploaded by

jy193857.yadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

1)What is the difference between ListBox and Drop Down List?

List and
explain any three common properties of these controls.
Ans: Common Properties of listbox and dropdown list:
1. Items:
 Both controls allow you to define a collection of items for the user to
select from.
 ListBox uses Items property, and DropDownList uses Items or Item to
hold options.
2. SelectedIndex:
 Represents the index of the currently selected item.
 In both ListBox and DropDownList, the SelectedIndex property can be
used to get or set which item is selected.

3.SelectedValue:

 It returns the value of the item you have selected.


It is usually used to get the value related to the selected item.

4 text
Both ListBox and DropDownList allow you to get or set the text of the
selected item using the Text property.

) Explain AdRotator control with an example.


Ans: AdRotator is a rich web server control in ASP.NET used to display a
series of advertisement images in a set order. The AdRotator control changes
the images every time the web page is reloaded.
The images shown by this control are specified in an external XML file. In the
XML file, we also specify some other attributes for the images, such as:
 ImageImpressions (shows how many times the image has been viewed)
 NavigateUrl (the URL the user will be directed to when they click the
image)
 ImageUrl (the path of the image)
 AlternateText (text shown if the image cannot be loaded)
By using the AdRotator control, the images change with every refresh of the
web page, allowing different advertisement images to be displayed effectively.
The Advertisement File:
<Advertisement>
<Ad>
<!--- first add here->
</Ad>
<Ad>
<!—second ad here-->
</Ad>
</Advertisement>

Advertisement File elements:


Properties
1. ImageUrl
Description :It is describe the path of image which will be displayed in adrotator
control.
Ex.<ImageUrl>images/abc.jpg</ImageUrl>
2. NavigateUrl: Describe the navigation webpage link when user click on ad
Image.
Ex. <NavigateUrl>https://www.example.com</NavigateUrl>

3. AlternateText: The text will be displayed when image can not be displayed.
Ex. <AlternateText>Click here to explore great deals!</AlternateText>
4. Impressions: Describe the display rate of image or priority of image
Ex. <Impressions>150</Impressions>
5. Keyword :It is a category of Ad.
Ex <Keyword>electronics</Keyword>
Class

The AdRotator class has a number of properties. You can use the
AdvertisementFile property to set the advertisement file, and the Target
property lets you decide where the link will open (like in a new window or
the same window).
1. _blank
The link opens in a new unframed window.
2. _parent
The link opens in the parent of the current frame.
3. _self
The link opens in the current frame.
4. _top
The link opens in the topmost frame of the current window.

4) ) Explain Calendar control with an example in ASP.NET.


Ans: Calendar Control
The Calendar Control provides a small calendar that you can use on any web
page. It is a rich control that can be programmed like an object, but it generates
many lines of HTML in its output.
<asp:Calendar id= “MyCalendar” runat= “server” />
Features:
1. Single-Month View:
The Calendar control shows only one month at a time.
2. Date Selection:
When a user clicks on a date, that date gets highlighted in a gray box.
3. Get Selected Date:
The selected date can be retrieved in the code as a DateTime object
using the Calendar.SelectedDate property.
Properties
1. SelectionMode
Description:
Specifies the type of selection that can be made.
Acceptable values:
o Day: Selects a single day.
o DayWeek: Selects an entire week.

2. SelectedDate
Description:
If a single date is selected, this property shows the currently selected date.
If multiple dates are selected, it shows the first selected date.

3. SelectedDates
Description:
This property provides a collection of all the selected dates.
It is used to determine the selection features.
Code:
<asp:Calendar ID="MyCalendar" runat="server"
BorderColor="Black"
BorderStyle="Solid"
BackColor="LightGray"
ForeColor="Blue"
ShowToday="true"
ShowNextPrevMonth="true"
OnSelectionChanged="MyCalendar_SelectionChanged" />
<asp:Label ID="Label1" runat="server" Text="Selected Date will appear
here"></asp:Label>

Code Explanation:
 ID="MyCalendar": The unique identifier for the calendar control.
 BorderColor="Black": Sets the border color of the calendar.
 BorderStyle="Solid": Defines the border style (solid line).
 BackColor="LightGray": Sets the background color of the calendar.
 ForeColor="Blue": Sets the text color for the calendar.
 ShowToday="true": Displays the "Today" button that takes the user to
the current date.
 ShowNextPrevMonth="true": Allows navigation between previous and
next months.
 OnSelectionChanged="MyCalendar_SelectionChanged": Defines the
event handler that fires when a user selects a date.

Q sitemapcontrol
The **SiteMapPath control** is mainly used to navigate from one webpage to
another. It is a navigation control that shows a map of the site related to the
website's pages. This map displays the pages of that particular website and the
names of those pages. By clicking on those specific pages, users can navigate to
them.

We can say that the **SiteMapPath control** shows links to connect with other
pages' URLs. It provides breadcrumb navigation, meaning it shows the user's
current location and allows the user to navigate to higher-level pa
ges using the links.

The **SiteMapPath control** is useful because it provides a quick view of the


current location and offers a way for users to go to upper levels.

The **SiteMapPath control** uses a property called **SiteMapProvider**,


which is used to access data from the database and store it in the data source.
The representation of the SiteMapPath control is as follows: ➢ Root Node->
Child Node.
Main Properties of SiteMapPath Control:
 ParentLevelsDisplayed: Determines how many parent nodes should be
displayed.
 RenderCurrentNodeAsLink: Specifies whether the current page's node
should appear as a hyperlink or not.
 PathSeparator: The string used to separate the nodes.
Style Properties of SiteMapPath:
 CurrentNodeStyle: Sets the style for the current node.
 RootNodeStyle: Sets the style for the root node.
 NodeStyle: Sets the style for all the nodes.

ASP.files and types


Definition: An ASPX file is a webpage used in ASP.NET. It contains the
design (HTML) and sometimes code to make the page work. The server
processes this file and sends a ready webpage to the user’s browser.
Types of Files in ASP.NET:
1. ASPX Files:
o The main webpage file.
o Contains design (HTML, CSS) and some server-side code.
2. Code-Behind Files (.cs or .vb):
o Contains the logic or functionality of the ASPX file, written in C#
or VB.NET.
o Keeps the coding separate from the design.
3. Web.config:
o A file used to set up settings for the website, like database
connections or security rules.
4. Global.asax:
o Manages events for the whole website, like when the site starts or
stops.
5. Master Pages (.master):
o A template file to make all pages look the same (header, footer,
layout).
6. User Controls (.ascx):
o Small reusable pieces, like a menu or a search bar, that can be
added to pages.
7. Stylesheets (.css):
o A file to define the colors, fonts, and layout of the website.
8. Script Files (.js):
o Contains JavaScript code to make the page interactive (like a
button click).
9. Resource Files (.resx):
o Stores text or data, usually for supporting multiple languages.
10.Assembly Files (.dll):
o Pre-written code files that the website uses to work properly.
Together, these files help build and run an ASP.NET website.

e) Write short note on page class.


The Page class in ASP.NET represents a web page in a web application. It
is a base class that every web page inherits from, and it provides properties,
methods, and events that help in managing the page's lifecycle and
functionality.
Properties of the Page Class:
1. IsPostBack: This boolean property tells if the page is being loaded for
the first time (false) or if it is being re-submitted due to a control event
(true), usually along with stored ViewState data.
2. EnableViewState: When set to `false`, it stops all controls from saving
their state, even if their own `EnableViewState` property is set to `true`.
3. Application: This collection stores information that is shared among all
users of the website.
4. Session: This collection saves information for one user, which can be
used on different pages for that same user.
5. Cache: This collection is used to store objects that take time to create, so
they can be reused on other pages or by different users. When used
correctly, it helps improve the performance of a web page.
6. Request: it refers to an HttpRequest object that holds information about
the current web request .It can be used to get details about the user's
browser or the data they entered.
7. Response: It refers to an `HttpResponse` object, which represents the
response that ASP.NET sends back to the user's browser.
8. Server: Refers to an HttpServerUtility object that provides access to
server-related functionality
9. User: If the user is authenticated, this property contains information
about the user.

You might also like