0% found this document useful (0 votes)
8 views

Advance Web development practical

The document outlines practical exercises for web development, including creating a simple application with server controls, a vacation planner using a calendar control, and demonstrating TreeView operations. It also covers the creation of a registration form with validation controls and a web form using AdRotator and user controls. Each section includes code snippets and descriptions of functionalities to be implemented.

Uploaded by

lazerbeast777
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
8 views

Advance Web development practical

The document outlines practical exercises for web development, including creating a simple application with server controls, a vacation planner using a calendar control, and demonstrating TreeView operations. It also covers the creation of a registration form with validation controls and a web form using AdRotator and user controls. Each section includes code snippets and descriptions of functionalities to be implemented.

Uploaded by

lazerbeast777
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 23
ae 219 8 [ PRACTICAL ~3 } practical - S(a) : Create a sii demonstrate setting and use of their properties, (Example: AutoPostBack ) 1. On click of 3 button control display the selected items from the list in textbox. Also in the s, 0 F i from the DropDownList! in Peet display. the name of the selected item i in a label. Also change the font size of the same label according to the font size Spm eae selected fro1 fot control for photo, rom the dropdownlist2. 3, Check Boxes provides special format 4. Use of AutoPostBack property, cntriUse.aspx ple web page with various server controls to ‘ting and Radio Buttons provides colour. ary VizwState Dates] | [estas | Select Colo: C Red © Greea C Bloe ‘SclectSpecial Formatting : [Bold [7 Italic [7 Undestine Select Size :[TOST ‘Select Name :[Yashashroe =] entriUse.aspx.cs public partial class _Default : System.Web.UI.Page ¢ protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { string str = "Vedshree Sambare"; if (ViewState|"name"] == null) { ViewState["name"] = str; } } Protected void btn_Click(object sender, EventArgs e) { IblStr.Text = ViewState["name"].ToString( ); wLT,, lopment (T-¥-BSe— £6) (Sem. _ ced Web Develo?” Advar 220 ree tArgs €) } ick(object sender, Even! protected void Button 1_Click(obj ( TextBox1.Text = i+) ts for (int i = 0; i < ListBox1.Items.Coun! ‘ a if (ListBox1.Items[i].Selected == true) { ‘TextBox1.Text = TextBox1.Text + } Protected void EventArgs e) { » 4 ListBox! -Items[i].Text + "\; DropDownList]. SelectedIndexChanged(object sender, Labell.Text = DropDownList 1.SelectedItem.Text; } Protected void DropDownList2_SelectedIndexChanged (object sender, EventArgs e) { } Protected void RadioButton 1_CheckedChan; { Labell.Font Size = int.Parse(DropDownList2.Selectedltem. Text); iged(object sender, EventArgs e) Labell.BackColor = System.Drawing.Color.Red; } { Protected void RadioButton2_CheckedChanged{object sender, EventArgs e) Labell.BackColor = System.Drawing.Color.Green; } Protected void RadioButton3 '-CheckedChanged(object sender, EventArgs e) { Labell.BackColor = Labell Font.Italic = true; } Protected void CheckB, System.Drawing.Color Blue; '0x3_CheckedC} i ecked hanged(object Sender, EventArgs e) t+ poets ree 221 abell.Font.Underline = true; V0 mesccstniowoss + ES € > © [D tocamoseees2/enttUseaspe Hi Appr @ tet hymoad hin) Tenda NN Wien ‘ViewState Data:Vedshree Sembare Seve Select Color: @Red Green © Blue Formatting : @Bold @ Italic @ Underline Select Size Select Name Practical - 3{b) : Create a simple application to demonstrate your vacation using calendar control. calndrCtrLaspx ‘acation Planner ‘San Mon Tue Wed Thu 30 1 2 3 4 7 8 9 10 1 12 14 15 16 17 18 19 21 22 23 24 25 26 27 28 29 30 31 2 6 9 45 iVacation Details: |prabetResutt] <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %> Advanced Web Development (T.¥.B.Se. ~ 1.7.) (5, 222 ror «head runat="server"> i

Vacation Planner









Sasp-Label ID="LabelResult” runat="server" Text="">
Text="Vacation server" TextMode="MultiLine: calndrCtrl.aspx.cs Public partial class Default : System.Web.ULPage { Protected void Page !Loadobject sender, EventArgs e) i F } Protected void Calendar1_Sele: ti ji ctionChanged(object sender, EventArgs e) LabelResult.Text e = Calendart ‘SelectedDate.ToshortDateStringl: selected: ‘i ‘ : ; Protected void Button1_Click(object sender, EventArgs e) { string vacationDate = Calendar1 Selected! : : Date. Ty ing(); String vacationDetails = TextBoxDetails. Text; oShorDateStringd; ] | / | i | t v2 223 i{(otring IsNullOrEmpty(vacationDetails)) { jabelResult.Text = "Please enter vacation details."; } else { LabelResult.Text = $"Vacation on {vacationDate}: {vacationDetails}"; Vacation Planner Select your vacation start date: Sun Mon Tue Wed Thu 28 22 30 31 1 gs 1 BM 20 21 a2 34 4 5 u 2 is Bw 12 [iSave Vacation|| ‘Vacation on 27-08-2024: Yashashree's Birthday Practical - 3{c) : Demonstrate the use of Treeview operations on the web form. Add XML File Website -> Add -> XML File and Name it ‘stdetail’. stdetail.xml 1 Tushar TYIT 224 ges Advanced Web Development (T- ¥.B.Se. ~ LT.) (Sem, — y 2 Sonali TYCS 3 Yashashree TYIT 4 Vedshree «sclass>TYCS Ybor a sn ate om We vb pty bn tind When practicals ooo 225 qreeViewDemp.aapx y Page Ce pilex"TreeViewDemo.aspx, <{DOCTYPE html> cehtml xmins="http:/ /www.w3.org/1999 /xdhtmt"> head runat="server"> ctitle> | ~ eform id="form1" runat="server">
> : __ 226 ree Advanced Web Development (T-¥-B-Sc. ~ 1.7.) (Soy, ~y PRACTICAL - 4 ioe use or ] Vaintical - 4(a) : Create a Registration form to demonstrate use o _ Validation controls, ValidationPract.aspx BventWi <%@ Page Language="C# ee TeUPetrue GodeFile="VatidationPract.aspx.cs" inherite~"ValidationPract” %> stitle> void ValidateBtn_OnClick(object sender, EventArgs €) { if (Page.IsValid) ( Ibl1.Text = "Thank Youl"; ) else { Toll Text + "The text must be exactly 8 characters long!"; } } void ServerValidation (object source, ServerValidateEventArgs e) { if (e. Value.Length == 8) e.lsValid = true; else e.IsValid = false; }
Your name:

Enter age:
Not valid age age">Not practical abr />
password:
casp: TextBox runat="server" id=" pebnter Password: eqsp-TextBox runat="server” id= ‘casp:compareValidator runat=" controltovalidate"txt12° wre 227 ‘txtl1" TextMode="Password” />
“txt12” TextMode="Password” />
Server" id="cmpNumbers” ForeColor="Red” ol - controltocompare="txt1 1" operator="LessThan” typew"Integer”_errormessage="Password > hould SprchlPassword sho br /> pmail ID:
br /> Custom text:

‘Button1" © Text="Validate” OnClick="ValidateBtn_OnClick” falidationSummary ID="ValidationSummary1" runat="server” Style="top: ; left: 24px; position: absolute; height: 38px; width: 625px; right: 487px;"
Web.config None” /> Se. - LT ‘Adoaneed Web Development (T-¥-B.Se. 17) (Sem, — y loathe. th tops © attcheodtin D) TosTInWiees ()_ WmAien Your nae: Please ener your name! Eater age: Not valid age Password Rebate Passat Password bod mal EmalD: Please exer aid emacs! Coser The text must be exactly 8 characters long! Practical - 4(b) :Create Web Form to demonstrate use of Adrotator Control, Add an XML file, name it “adds.xm!" i : 229 eo ‘dd images to test out the Adrotator functionality. Default.espx <%@ Page Language="C#" AutoEventWireup="true” CodeFile="Default.aspx.cs" Inherits="_Default” %>
" “sfasp:ScriptManager> br />
I OTY.BSc. (7 Advanced Web Development (Sem-V) 230 OUTPUT: [7.0 wanartosemcats ws €>¢|0 Tocathost:10399/Default-asPx ps @ nest hoiywood hin, ©) Tend 118 LB fon @ nenneiredt” BEET Practical - 4{c) : Create Web Form to demonstrate use User Controls. Add Web User Control Website -> Add -> Web User Control and Name it footer’. 7 x [Berkhaae Tempted Tipe Vinal CF ‘Rad New Rem Pewee ree 231 eng) Control Languago="Cu" A, , . sneritne"{ooter" “ie MMoLventWireup="true" Codelile="footer.anc:
‘ambria; background-color: #00CC! color: #0000; font-weight: bold; td> AutoEventWireup="(ruc" CodeFile="Default.aspx.cs" oe Rogister Sro="~/footor.asox" TagName="footor" TagProfix="STfooter" _
_ "

" <8Tfooter:footer ID="footer1" runat="server" />
OUTPUT : Dy locathost1342 x € > ES [O tocatnose13428/0..._ x ‘Apps 3 latest hollywood hin, ‘Welcome to ASP.Net opment (TY.B.SC.~ 17.) (Sem _ 232 roe ‘Advanced Web Devel ‘PRACTICAL - 5 Website Na Practical ~ 5{a) : Create Web Form to demonstrate use of ‘VIBRtion controls and Site Map. Add Site Map File Website -> Add -> Site Map and Name it ‘Web.Sitemap’. ‘Ad New Rem - prac _' *x Web.Sitemap Now, Drag and Drop a SiteMapDataSource control and Menu control from Toolbox to the page. ir rew 233 PractSa.aspx aay ) iocathostB652/Defauit32 x © bocathost8652/practSa.aspx Practical - 5(b) : Create a web application to demonstrate use of Master Page and content page. MasterPage.master oe Master Languag CodeFile="MasterPage.master.cs” Inherit sIDOCTYPE html> cH AutoEventWireuy ‘MasterPage" %> ‘true” | TY.BSc.-1T) (Sem. — 236 woe dvaneed We’ DevelapmeTs (TX P ny head runat="server"> ctitle>
demo.aspx older1” runat="server"> be />
: ‘ br focor />
pacts was 235 praction’ pie + Create a web application to demonstrate various States of ASP. 1 -4 1. View State: p3a.0sPX paa.aspX.cs . public partial class P3a : System.Web.UI Page protected void Page_Load(object sender, EventArgs e) { if (IIsPostBack) { string str = "Vedshree Sambare"; if (ViewState["nam"] == null) { ViewState["nam"] = str; } protected void btn_Click(object sender, EventArgs e) { IbIStr. Text = ViewState["nam"].ToString{ }; Default3.aspx Default3.aspx.cs protected void btnSend_Click(object sender, EventArgs e) { Response.Redirect("Default4.aspx?Userld=" + —txtUserid.Text + "&UserName=" + txtUserName.Text); } YB. ced Web Development (T- 236 reer Adee _ ee Q pe ic Waines in Delanit3.aspx Page Userla:[b1Usecia] Default4.aspx.cs Protected void Page Load(object sender, EventArgs €) { if (lsPostBack) i { | IblUserld.Text = Request. QueryString["Userld"]; i IblUserName.Text = Request.QueryString|"UserName"]; Methestin. (Took vasa) Lares (QuerStrng parameter Valuesin Defias agg ‘Userldss1234 UserName:Sonali ‘Se.- LT) (Sem, yy yr Proatcals ror 297 3. Cookies pefaultS.aspx ‘ColorSelector_Indexchanged”> + -6/aspsListItes> :ListTtem value="Blue">Blue Default5.aspx.cs using System.Data; public partial class DefaultS : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (Request.Cookies["BackgroundColor"] != null) { ColorSelector.SelectedValue = Request.Cookies["BackgroundColor’].Value; BodyTag.Style["background-color’] = ColorSelector.SelectedValue; } } protected void ColorSelector_IndexChanged{(object sender, EventArgs e) { BodyTag.Style["background-color’] = ColorSelector.SelectedValue; HttpCookie cookie = new HttpCookie("BackgroundColor’); cookie.Value = ColorSelector.SelectedValue; cookie.Expires = DateTime.Now.AddMilliseconds(20); Response.SetCookie(cookie); } } OUTPUT : fo locathost2920/DefauitS.2 x (ed ©€.> GS | O locathost2920/Defauks.aspx HEE Apps @ ltestholtyocd hin’) Tenda TINY [Green| PY BS of (SG, = VP ‘Advanced Web Development (1.Y.B.Se. 238 wen 4. Session and Application State 1. Create website and add webform. lication. 2. Adding a Global.asax to web applications 3. Add New Item > Global Application Cla: Global.asax <%@ Application Language="C#" %> | web.config | E | Default.aspx <%@ Page Language="C#" . AutoEventWireup="true" CodeFil Inherits="_Default" %>
Visitors Count :<%=Application["OnlineUsers"].ToString{ ) %>
** Database Prerequisite Note: For Database practical’s we have used SQL Server 2014 version. Here we to add new database in our website, as shown below. Add this database inside App_Data folder. ’ 1. Bodnar Dh oanatpers 6) Datoaninre BBB Wencots| 4 til Tables A Customer ees co eas ae verve ‘The structure of the tables are displayed below. Customer Table PK.CUSTOMER (Primary Key, Clustered: Id) (Check Cometrants (0) 4 tenes (1) IndexCustomerName (LastName, FirstName) Foreign Kays (0) Triggers practical orderitem Table ae Cn Product Table hit (Design) 2 | ren 241 PKLORDERITEM (Primary Key, Chastered Kd) (Check Contrainte (0) 4 tedemes 2 IndexOrdettemOrderd. (Orders) IndexOrderteProductid Products) 4 Forelga Keys 2) FKORDERTE REFERENCE,ORDER (i) FKORDERTE REFERENCE PRODUCT 04) 4 Kays) PK PRODUCT (Primary Key, Custeret 1d) (Check Constraints (0) 4 tacdexes 2) IndeProductSupplietd Supplier) IndeProductName (ProductName) 4 Foreign Keys (1) FK.PRODUCT REFERENCE. SUPPLIER (1)

You might also like