RichControl in Asp.net

29
1 Rich Control In Asp.net

Transcript of RichControl in Asp.net

Page 1: RichControl in Asp.net

1

Rich Control In Asp.net

Page 2: RichControl in Asp.net

2

• What is Rich Control ?• AdRotator Control and Example• File Upload Control and Example• Multiview Control and Example• Calender Control and Example• Wizard Control and Example• Advantage• Reference

ContentRich Control

Page 3: RichControl in Asp.net

3

What is Rich Control..??• The Control which are not standard control and allow

you to do some advanced functionality are know as “RICH CONTROL”

• Rich controls are built with multiple HTML elements and contain rich functionality.

• Although rich control is combination of other standard controls,it work as a single control.

Rich Control

Page 4: RichControl in Asp.net

4

AdRotator Control

• ASP.NET gives you one very useful and important control to develop advertisement banners called « AdRotator Control »

• AdRotaror control has only one very important property called « AdvertisementFile » which basically a XML file.

• AdvertisementFile Contains details about the advertisements.

Rich Control

Page 5: RichControl in Asp.net

5

Properties• Add control where banner is to display• Properties:

AdvertisementFile :-XML file of banners

KeywordFilter:- only banners with this keyword

Target :-where to display hyperlink

Height/Width:- if want the same for all banners

Rich Control

Page 6: RichControl in Asp.net

6

Syntax

<asp:AdRotator id="Value"

AdvertisementFile="AdvertisementFile

KeyWordFilter="KeyWord“ Target="Target"

runat="server“

AlternateText=“text”/>

</asp:AdRotator>

Rich Control

Page 7: RichControl in Asp.net

7

Cont…

Only ads with this keyword

XML file of banner info

Rich Control

Page 8: RichControl in Asp.net

8

Example

<asp:AdRotator ID="AdRotator1"

runat="server"

AdvertisementFile ="ads.xml"

AlternateText="Hello" />

</asp:AdRotator>

Rich Control

Page 9: RichControl in Asp.net

9

OutputRich Control

Page 10: RichControl in Asp.net

10

File Upload Control• The file upload control used to select (Browse)any

file from your pc and then the uploaded file is used for some specific operation.

• It just gives you the path of file along with its name.

Rich Control

Page 11: RichControl in Asp.net

11

Property• File Name:

Gives you the name of file which is uploaded.

• HasFile:

Return Boolean value True or False.• FileContent:

This is collection which gives details about file contents.

Rich Control

Page 12: RichControl in Asp.net

12

Example• protected void Save_Click(object sender, EventArgs e)

{

string str;

string f1;

f1=Path.GetFileName(FileUpload1.PostedFile.FileName);

FileUpload1.SaveAs(Server.MapPath("~/images/" + f1));

str = "images/" + FileUpload1.FileName.ToString();

}

Rich Control

Page 13: RichControl in Asp.net

13

Output

Page 14: RichControl in Asp.net

14

Multiview• Multiview Control used for many view.

• Sometime it have many screens but at a time display only one screen.

• Multiview is a container of group of view control.

• In Multiview select only one view at a time that is called “Active View”

Rich Control

Page 15: RichControl in Asp.net

15

Property• ActiveViewIndex:

It will be used to set or get the index no. of current active view.

• Views.Count

Views.count will give total no. of views under multiview.

Rich Control

Page 16: RichControl in Asp.net

16

Example• <body> <asp:multiview ID="Multiview1" runat="server"> <asp:View ID="view1" runat="server"> <center><h1>Calendar</h1></center> <asp:Calendar ID="cal1" runat="server"></asp:Calendar> </asp:View> <asp:View ID="view2" runat="server"> <center><h2>Image</h2></center> <asp:Image ID="img" runat="server" ImageUrl="~/ab/Koala.jpg"/> </asp:View> </asp:multiview>

Rich Control

Page 17: RichControl in Asp.net

17

OutputRich Control

Page 18: RichControl in Asp.net

18

Calender Control• The Calendar control is created by the Calendar class

• Thé calendar displays a single calendar month

• By default, the current month is displayed– You can configure the appearance of the calendar

by setting the properties of the calendar control.

Rich Control

Page 19: RichControl in Asp.net

19

Properties• The Calendar control supports the following

properties:

DayNameFormat—Enables you to specify the appearance of the days of the week.Possible values are FirstLetter, FirstTwoLetters, Full, Short.

NextMonthText—Enables you to specify the text that appears for the next month link.

Rich Control

Page 20: RichControl in Asp.net

20

Cont…• SelectedDate—Enables you to get or set the selected

date

• SelectionMode—Enables you to specify how dates are selected. Possible values are Day, DayWeek, DayWeekMonth.

• ShowDayHeader—Enables you to hide or display the day names at the top of the Calendar control.

Rich Control

Page 21: RichControl in Asp.net

21

Example

<form id="form1" runat="server">

<asp:Calendar ID="Calendar1" runat="server"

SelectionMode="DayWeekMonth">

</asp:Calendar>

</form>

Rich Control

Page 22: RichControl in Asp.net

22

OutputRich Control

Page 23: RichControl in Asp.net

23

Wizard Control• Wizard has many screen which comes after one

another.• For wizard we say “Start->Next->Next->..->Finish”• Where screen starts with “Start” scrren and goes up to

last screen.• Wizard has different THREE parts:

Main , Header , SideBar

Rich Control

Page 24: RichControl in Asp.net

24

Property• ActiveStepIndex: It is used to set or get the index no.of currently

active step.• HeaderText: HeaderText will be display in all the steps as

header information.• WizardSteps.Count: Returns how many no. of steps are specified

in wizardSteps.

Rich Control

Page 25: RichControl in Asp.net

25

Example• <asp:Wizard ID="Wizard1" runat="server">

<WizardSteps>

<asp:WizardStep ID="WizardStep1" runat="server" Title="Step 1">

</asp:WizardStep>

<asp:WizardStep ID="WizardStep2" runat="server" Title="Step 2">

</asp:WizardStep>

</WizardSteps>

</asp:Wizard>

Rich Control

Page 26: RichControl in Asp.net

26

OutputRich Control

Page 27: RichControl in Asp.net

27

Advantage• It is very flexible control.

• Control has high performance.

• Rich control reduce the code and give the high performance.

• Consume the developer time.

Rich Control

Page 28: RichControl in Asp.net

28

Reference• asp.net-tutorials.com/controls • asp-net-example.blogspot.com • www.tutorialspoint.com/asp.net • www.wrox.com/.../ASP-NET

Rich Control

Page 29: RichControl in Asp.net

29

Thank You