StuDocu is not sponsored or endorsed by any college or university Awp journal - ..... Bscit (Somaiya Vidyavihar University) StuDocu is not sponsored or endorsed by any college or university Awp journal - ..... Bscit (Somaiya Vidyavihar University) Downloaded by Sadiya Shaikh (196sadiyashaikh@gmail.com) lOMoARcPSD|18087173 Sr No. Practical Date 1 Working with basic C# and Asp.NET a. Create an application that obtains four int values from the user and displays the product b. Create an application to demonstrate string operations c. Create an application that receives the (Student Id, Student Name, Course Name, Date of Birth) information from a set of students. The application should also display the information of all students once the data entered d. Create an application to demonstrate the following operations: Generate Fibonacci series Test for Prime Number Test for vowels Reverse of a number and find the sum of digits of a number 2. Working with Object Oriented C# and Asp.NET a. Create simple application to perform following operations: Finding Factorial value Money Conversion Temperature Conversion b. Create simple application to demonstrate use of following concepts: Function Overloading Inheritance(All Types) Constructor Overloading Interfaces 3. Working with Web Forms and Controls a. Create a simple webpage with various server controls to demonstrate the setting and use of their properties b. Demonstrate the use of calendar control Display message in calendar Display vacation in calendar Difference between 2 calendar dates Select date using style c. Demonstrate the use of Treeview control and perform following operations: Treeview control and Datalist Treeview operations 4. Working with Form Controls a. Create a registration form to demonstrate use of various Validation controls b. Create Web Form to demonstrate use of Adrotator Control Downloaded by Sadiya Shaikh (196sadiyashaikh@gmail.com) lOMoARcPSD|18087173 c. Create a Web Form to demonstrate use of User Controls 5. Working with Navigation , Beautification and Master Page a. Create a web form to demonstrate use of Website navigation controls and Site Map b. Create a web Application to demonstrate use of Master Page with applying Styles and Themes for page beautification 6. Create a web application to display records from the database 7. Create a web application to demonstrate databinding using DetailsView and FormView Control 8. Create a web application to demonstrate GridView Control Downloaded by Sadiya Shaikh (196sadiyashaikh@gmail.com) lOMoARcPSD|18087173 Practical 1 a. Create an application that obtains four int values from the user and displays the product Input: using System; namespace prac1a { class Program { static void Main( string [] args) { Console.WriteLine( "Sapna Girme (31010920022)" ); Console.WriteLine( "Enter First Number" ); int num1 = Convert.ToInt32(Console.ReadLine()); Console.WriteLine( "Enter Second Number" ); int num2 = Convert.ToInt32(Console.ReadLine()); Console.WriteLine( "Enter Third Number" ); int num3 = Convert.ToInt32(Console.ReadLine()); Console.WriteLine( "Enter Fourth Number" ); int num4 = Convert.ToInt32(Console.ReadLine()); int product = num1 * num2 * num3 * num4; Console.WriteLine( "Product Output: " + product); Console.ReadKey(); } } } Output: Downloaded by Sadiya Shaikh (196sadiyashaikh@gmail.com) lOMoARcPSD|18087173 b. Create an application to demonstrate string operations Input: using System; namespace prac1b { class Program { static void Main( string [] args) { Console.WriteLine( "Sapna Girme (31010920022)" ); String s = " My name is sam" ; Console.WriteLine( "String is:" + s); int length = s.Length; Console.WriteLine( "Length of s is:" + length); String s2 = "Sam" ; String s3 = "Richards" ; String s4 = String.Concat(s2, s3); Console.WriteLine( "Value of s4 (Concatenated String) is :" + s4); String s5 = s.Trim(); Console.WriteLine( "Value of s5 (Trimmed string ) is:" + s5); int l_new = s5.Length; Console.WriteLine( "New length of s is:" + l_new); String upper = s3.ToUpper(); Console.WriteLine( "String converted to Uppercase: " + upper); String lower = s3.ToLower(); Console.WriteLine( "String converted to Lowercase: " + lower); String substring = s.Substring(0, 6); Console.WriteLine( "Substring:" + substring); String s6 = "My-nmae-is-sam" ; String[] breaksentence = s6.Split( '-' ); foreach (String data in breaksentence) Console.WriteLine(data); String[] join_array = { "Hello!!!" , "this" , "is" , "my" , "first" , "c#" , "program" }; String s7 = String.Join( "-" , join_array); Console.WriteLine( "Joined" + s7); Console.ReadKey(); } } } Downloaded by Sadiya Shaikh (196sadiyashaikh@gmail.com) lOMoARcPSD|18087173 Output: Downloaded by Sadiya Shaikh (196sadiyashaikh@gmail.com) lOMoARcPSD|18087173 c. Create an application that receives the (Student Id, Student Name, Course Name, Date of Birth) information from a set of students. The application should also display the information of all students once the data entered Source Code: <% @ Page Language ="C#" AutoEventWireup ="true" CodeBehind ="WebForm1.aspx.cs" Inherits ="prac1c.WebForm1" %> <! DOCTYPE html > < html xmlns ="http://www.w3.org/1999/xhtml"> < head runat ="server"> < title ></ title > </ head > < body > < form id ="form1" runat ="server"> < div > < asp : Label ID ="Label7" runat ="server" Text ="Sapna Girme (31010920022)"></ asp : Label > < br /> < asp : Label ID ="Label1" runat ="server" Text ="STUDENT REGISTRATION FORM"></ asp : Label > < br /> < br /> < asp : Label ID ="Label2" runat ="server" Text ="Student Id"></ asp : Label > < asp : TextBox ID ="TextBox1" runat ="server" style =" position : relative; top : 3px; left : 37px"></ asp : TextBox > < br /> < br /> < asp : Label ID ="Label3" runat ="server" Text ="Student Name"></ asp : Label > < asp : TextBox ID ="TextBox2" runat ="server" OnTextChanged ="TextBox2_TextChanged1" style =" position : relative; top : 1px; left : 10px"></ asp : TextBox > < br /> < br /> < asp : Label ID ="Label4" runat ="server" Text ="Course Name"></ asp : Label > < asp : TextBox ID ="TextBox3" runat ="server" style =" position : relative; top : 1px; left : 11px"></ asp : TextBox > < br /> < br /> < asp : Label ID ="Label5" runat ="server" Text ="Date of Birth"></ asp : Label > < br /> < asp : Calendar ID ="Calendar1" runat ="server"></ asp : Calendar > < br /> < asp : Button ID ="Button1" runat ="server" OnClick ="Button1_Click" Text ="Submit" /> < br /> Downloaded by Sadiya Shaikh (196sadiyashaikh@gmail.com) lOMoARcPSD|18087173 < br /> < asp : Label ID ="Label6" runat ="server"></ asp : Label > </ div > </ form > </ body > </ html > .cs Code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace prac1d { public partial class WebForm1 : System.Web.UI.Page { protected void Page_Load( object sender, EventArgs e) { } int num = 0; protected void Button1_Click( object sender, EventArgs e) { int i, f1 = 0, f2 = 1, f3 = 0; num = Convert.ToInt16(TextBox1.Text); Label3.Text = f1 + "<br>" + f2; for (i=1; i<=num;i++) { f3 = f1 + f2; Label3.Text += "<br>" + f3; f1 = f2; f2 = f3; } } protected void Button2_Click( object sender, EventArgs e) { num = Convert.ToInt16(TextBox1.Text); int k = 0; for ( int i=1;i<=num; i++) { Downloaded by Sadiya Shaikh (196sadiyashaikh@gmail.com) lOMoARcPSD|18087173 if (num % i == 0) { k++; } } if (k==2) { Label3.Text = num + " is a Prime Number" ; } else { Label3.Text = num + " is not a Prime Number" ; } } protected void Button3_Click( object sender, EventArgs e) { num = Convert.ToInt16(TextBox1.Text); int Reverse = 0; while (num>0) { int remainder = num % 10; Reverse = (Reverse * 10) + remainder; num = num / 10; } Label3.Text = "Reverse number is " + Reverse; } protected void Button4_Click( object sender, EventArgs e) { int m, sum = 0; num = Convert.ToInt16(TextBox1.Text); while (num>0) { m = num % 10; sum = sum + m; num = num / 10; } Label3.Text = "Sum is " + sum; } protected void Button5_Click( object sender, EventArgs e) { char ch = Convert.ToChar(TextBox2.Text); Downloaded by Sadiya Shaikh (196sadiyashaikh@gmail.com) lOMoARcPSD|18087173 switch (ch) { case 'a' : case 'A' : Label4.Text = ch + " is vowel" ; break ; case 'e' : case 'E' : Label4.Text = ch + " is vowel" ; break ; case 'i' : case 'I' : Label4.Text = ch + " is vowel" ; break ; case 'o' : case 'O' : Label4.Text = ch + " is vowel" ; break ; case 'u' : case 'U' : Label4.Text = ch + " is vowel" ; break ; default : Label4.Text = ch + " is not vowel" ; break ; } } } } Output: Downloaded by Sadiya Shaikh (196sadiyashaikh@gmail.com) lOMoARcPSD|18087173 d. Create an application to demonstrate the following operations: Generate Fibonacci series Test for Prime Number Test for vowels Reverse of a number and find the sum of digits of a number Source Code: <% @ Page Language ="C#" AutoEventWireup ="true" CodeBehind ="WebForm1.aspx.cs" Inherits ="prac1d.WebForm1" %> <! DOCTYPE html > < html xmlns ="http://www.w3.org/1999/xhtml"> < head runat ="server"> < title ></ title > </ head > < body > < form id ="form1" runat ="server"> < div > < asp : Label ID ="Label5" runat ="server" Text ="Sapna Girme (31010920022)"></ asp : Label > < br /> < asp : Label ID ="Label1" runat ="server" Text ="Enter a number:"></ asp : Label > < asp : TextBox ID ="TextBox1" runat ="server"></ asp : TextBox > < br /> < br /> < asp : Button ID ="Button1" runat ="server" OnClick ="Button1_Click" Text ="Fibonacci Series" /> < asp : Button ID ="Button2" runat ="server" OnClick ="Button2_Click" Text ="Prime Number" /> < asp : Button ID ="Button3" runat ="server" OnClick ="Button3_Click" Text ="Reverse" /> < asp : Button ID ="Button4" runat ="server" OnClick ="Button4_Click" Text ="Sum of Digits" /> < br /> < asp : Label ID ="Label3" runat ="server"></ asp : Label > < br /> < br /> < asp : Label ID ="Label2" runat ="server" Text ="Enter a Character:"></ asp : Label > < asp : TextBox ID ="TextBox2" runat ="server"></ asp : TextBox > < asp : Button ID ="Button5" runat ="server" OnClick ="Button5_Click" Text ="Find Vowel" /> < br /> < asp : Label ID ="Label4" runat ="server"></ asp : Label > < br /> < br /> </ div > Downloaded by Sadiya Shaikh (196sadiyashaikh@gmail.com) lOMoARcPSD|18087173 </ form > </ body > </ html > .cs Code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; class fact { public int n, f; public fact () { f = 1; } public void cal() { int i; for (i=1;i<=n;i++) { f = f * i; } } } namespace factorial { public partial class WebForm1 : System.Web.UI.Page { protected void Page_Load( object sender, EventArgs e) { } protected void Button1_Click( object sender, EventArgs e) { fact f1 = new fact(); f1.n = Convert.ToInt32(TextBox1.Text); f1.cal(); Downloaded by Sadiya Shaikh (196sadiyashaikh@gmail.com) lOMoARcPSD|18087173 Label2.Text = f1.f.ToString(); }}} Output: Downloaded by Sadiya Shaikh (196sadiyashaikh@gmail.com) lOMoARcPSD|18087173 Practical 2 a. Create simple application to perform following operations: Finding Factorial value Money Conversion Temperature Conversion Finding Factorial value Source Code: <% @ Page Language ="C#" AutoEventWireup ="true" CodeBehind ="WebForm1.aspx.cs" Inherits ="factorial.WebForm1" %> <! DOCTYPE html > < html xmlns ="http://www.w3.org/1999/xhtml"> < head runat ="server"> < title ></ title > </ head > < body > < form id ="form1" runat ="server"> < div > < asp : Label ID ="Label3" runat ="server" Text ="Sapna Girme (31010920022)"></ asp : Label > < br /> < asp : Label ID ="Label1" runat ="server" Text ="Enter a number"></ asp : Label > < asp : TextBox ID ="TextBox1" runat ="server"></ asp : TextBox > < asp : Button ID ="Button1" runat ="server" OnClick ="Button1_Click" style =" position : relative" Text ="Factorial" /> < br /> < br /> < asp : Label ID ="Label2" runat ="server"></ asp : Label > </ div > </ form > </ body > </ html > .cs Code: using System; class fact { public int n, f; public fact () { f = 1; } Downloaded by Sadiya Shaikh (196sadiyashaikh@gmail.com) lOMoARcPSD|18087173 public void cal() { int i; for (i=1;i<=n;i++) { f = f * i; } } } namespace factorial { public partial class WebForm1 : System.Web.UI.Page { protected void Page_Load( object sender, EventArgs e) { } protected void Button1_Click( object sender, EventArgs e) { fact f1 = new fact(); f1.n = Convert.ToInt32(TextBox1.Text); f1.cal(); Label2.Text = "Factorial of " + f1.n.ToString() + " is " + f1.f.ToString(); } } } Output: Downloaded by Sadiya Shaikh (196sadiyashaikh@gmail.com) lOMoARcPSD|18087173 Money Conversion Source Code: <% @ Page Language ="C#" AutoEventWireup ="true" CodeBehind ="WebForm1.aspx.cs" Inherits ="money_conversion.WebForm1" %> <! DOCTYPE html > < html xmlns ="http://www.w3.org/1999/xhtml"> < head runat ="server"> < title ></ title > </ head > < body > < form id ="form1" runat ="server"> < div > < asp : Label ID ="Label3" runat ="server" Text ="Sapna Girme (31010920022)"></ asp : Label > < br /> < asp : Label ID ="Label1" runat ="server" Text ="Enter Amount "></ asp : Label > < asp : TextBox ID ="TextBox1" runat ="server"></ asp : TextBox > < asp : Label ID ="Label2" runat ="server" Text ="After Conversion(Indian Rupees)"></ asp : Label > < asp : TextBox ID ="TextBox2" runat ="server"></ asp : TextBox > < br /> < br /> < asp : DropDownList ID ="DropDownList1" runat ="server"> < asp : ListItem > USD </ asp : ListItem > < asp : ListItem > EURO </ asp : ListItem > < asp : ListItem > POUND </ asp : ListItem > < asp : ListItem > YEN </ asp : ListItem > </ asp : DropDownList > < br /> < br /> < asp : Button ID ="Button1" runat ="server" OnClick ="Button1_Click" Text ="Convert" /> </ div > </ form > </ body > </ html > .cs Code: using System; namespace money_conversion { public partial class WebForm1 : System.Web.UI.Page Downloaded by Sadiya Shaikh (196sadiyashaikh@gmail.com) lOMoARcPSD|18087173 { double a; public double dollar( double num) { a = num * 73.47; return a; } public double euro( double num) { a = num * 86.62 ; return a; } public double pound( double num) { a = num * 101.08; return a; } public double yen( double num) { a = num * 0.67; return a; } protected void Page_Load( object sender, EventArgs e) { } protected void Button1_Click( object sender, EventArgs e) { string b; b = DropDownList1.SelectedItem.Text; Double num = Convert.ToDouble(TextBox1.Text); if (b== "USD" ) { TextBox2.Text =Convert.ToString(dollar(num)); } else if (b == "EURO" ) { TextBox2.Text = Convert.ToString(euro(num)); } else if (b == "POUND" ) { TextBox2.Text = Convert.ToString(pound(num)); } Downloaded by Sadiya Shaikh (196sadiyashaikh@gmail.com) lOMoARcPSD|18087173 else if (b == "YEN" ) { TextBox2.Text = Convert.ToString(yen(num)); } else { TextBox2.Text = "Please select a currency to convert " ; } } } } Output: Temperature Conversion Source Code: <% @ Page Language ="C#" AutoEventWireup ="true" CodeBehind ="WebForm1.aspx.cs" Inherits ="temperature_conversion.WebForm1" %> <! DOCTYPE html > < html xmlns ="http://www.w3.org/1999/xhtml"> < head runat ="server"> < title ></ title > </ head > < body > < form id ="form1" runat ="server"> < div > < asp : Label ID ="Label3" runat ="server" Text ="Sapna Girme (31010920022)"></ asp : Label > < br /> < br /> < asp : TextBox ID ="TextBox1" runat ="server"></ asp : TextBox > Downloaded by Sadiya Shaikh (196sadiyashaikh@gmail.com) lOMoARcPSD|18087173 < asp : TextBox ID ="TextBox2" runat ="server"></ asp : TextBox > < br /> < asp : Label ID ="Label1" runat ="server" Text ="Enter a value"></ asp : Label > < asp : Label ID ="Label2" runat ="server"></ asp : Label > < br /> < br /> < asp : DropDownList ID ="DropDownList1" runat ="server"> < asp : ListItem > Celcius_To_Farenheit </ asp : ListItem > < asp : ListItem > Farenheit_To_Celcius </ asp : ListItem > </ asp : DropDownList > < asp : Button ID ="Button1" runat ="server" OnClick ="Button1_Click" Text ="Convert" /> </ div > </ form > </ body > </ html > .cs Code: using System; class Conversion { public float cel, fr; public Conversion () { cel = 0; fr = 0; } public void Cel_To_Faren() { fr = (cel * 9) / 5 + 32; } public void Faren_To_Cel() { cel = (fr - 32) * 5 / 9; } Downloaded by Sadiya Shaikh (196sadiyashaikh@gmail.com) lOMoARcPSD|18087173 } namespace temperature_conversion { public partial class WebForm1 : System.Web.UI.Page { protected void Page_Load( object sender, EventArgs e) { } protected void Button1_Click( object sender, EventArgs e) { Conversion c = new Conversion(); string b; b = DropDownList1.SelectedItem.Text; if (b== "Celcius_To_Farenheit" ) { c.cel = float .Parse(TextBox1.Text); c.Cel_To_Faren(); TextBox2.Text = Convert.ToString(c.fr); Label2.Text = "Celcius To Farenheit" ; } else { c.fr = float .Parse(TextBox1.Text); c.Faren_To_Cel(); TextBox2.Text = Convert.ToString(c.cel); Label2.Text = "Farenheit To Celcius " ; }} } } Output: Downloaded by Sadiya Shaikh (196sadiyashaikh@gmail.com) lOMoARcPSD|18087173