Dot Net Programs

  • Uploaded by: TB
  • 0
  • 0
  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Dot Net Programs as PDF for free.

More details

  • Words: 3,926
  • Pages: 76
Name: Tanmay Baid Roll Number: 0829cs071112

List of Programs: 1.

WAP to print “HELLO C#” 3

2.

WAP to read two integer numbers and print the sum 6

3.

WAP to input and output 5 numbers using array and function 8

4.

WAP using 2D array to print a matrices 10

5.

WAP to print jagged array and also find the number of rows and number of columns in each row 12

6.

WAP to find sum of two number using function 14

7.

WAP to show how static data member works in a class 16

8.

WAP to check whether the two entered string are equal or not using string class and its methods. also find the length of each string 18

9.

WAP to show how we can use structure in a class 20

10. WAP

to show how structure variable works differently than class variable (object) 22

11. WAP

to show how we can pass object as an argument to a function 24

1

Name: Tanmay Baid Roll Number: 0829cs071112 12. WAP

that will work like copy constructor of c++

26 13. WAP

that contains different classes but no inheritance

28 14. WAP

to inherit base class into derived class (no method overriding) 30

15. WAP

to show polymorphism using virtual and override keyword 33

16. WAP

to show how we can use abstract class and abstract method 36

17. WAP

to show multiple inheritance using class and interface

38 18. WAP

to avoid inheritance of particular method

40 19. WAP

to show how we can use enumeration to define symbolic constants for color 41

20. WAP

to show how we can use enumeration to define symbolic constants for on/off (1,0) values 43

2

Name: Tanmay Baid Roll Number: 0829cs071112 21. WAP

to print name and surname from command line. 42

22. WAP

to find sum and average of n numbers entered by user using foreach loop. 47

23. Create

a Windows form to calculate compound interest and print the result on message box. 49

24. Create

a windows form to show stored data in sql server database on form using GridView control. 51

25. Create

a windows form to insert student information in table named “STU”. 53

26. Create

a windows MDI form, add Menu on it and link it to various dialogs, forms. 55

27. Create

HTML form using notepad and print “Hello Html” in explore. 58

28. Create

an asp.net page to show use of various standard controls. 60

29. Create

an asp.net page for new registration and insert record in sql database. Show the inserted records on another page. 61

30. Create

an asp.net page to show use of various validation controls. 63

31. Create

an asp.net page to display random image using AdRotator control and XML file. 64 3

Name: Tanmay Baid Roll Number: 0829cs071112 32. Create

an asp.net page to show use of Web User Control. 66

33. Create

an asp.net page to allow update, edit, delete option on GridView control. 68

34. Create

and apply .css(Cascading Style Sheet) file. 69

35. Create

and apply .skin (Theme) file. 71

// 1. WAP to print “HELLO C#” using System; using System.Collections.Generic; using System.Text; namespace printname { class Program { static void Main(string[] args) { Console.WriteLine("HELLO C#"); Console.ReadLine(); } 4

Name: Tanmay Baid Roll Number: 0829cs071112 } }

Output:

5

Name: Tanmay Baid Roll Number: 0829cs071112

// 2. WAP to read two integer numbers and print the sum using System; 6

Name: Tanmay Baid Roll Number: 0829cs071112 using System.Collections.Generic; using System.Text; namespace ConsoleApplication3 { class Program { static void Main(string[] args) { Console.WriteLine("Enter the first number:"); string s1 = Console.ReadLine(); int a1 = Convert.ToInt32(s1); Console.WriteLine("Enter the second number:"); string s2 = Console.ReadLine(); int a2 = Convert.ToInt32(s2); int s3 = a1 + a2; Console.WriteLine("The sum is:" + s3); Console.ReadLine(); } } }

7

Name: Tanmay Baid Roll Number: 0829cs071112 Output:

8

Name: Tanmay Baid Roll Number: 0829cs071112 // 3. WAP to input and output 5 numbers using array and function using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication { class Array { static void Main(string[] args) { int[] a = new int[5]; GetArray(a); Console.WriteLine("ENTERED NUMBER IS\n"); for (int i = 0; i < a.Length; i++) Console.WriteLine("a[" + i + "]=" + a[i]); Console.ReadLine(); } static void GetArray(int[] a) { Console.WriteLine("ENTER 5 NUMBERS"); for (int i = 0; i < a.Length; i++) a[i] = int.Parse(Console.ReadLine()); } } }

9

Name: Tanmay Baid Roll Number: 0829cs071112

Output:

10

Name: Tanmay Baid Roll Number: 0829cs071112

// 4. WAP using 2D array to print a matrices. using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication6 { class TwoDArray { static void Main(string[] args) { int[,] a; a = new int[2, 3]; a[0, 0] = 50; a[0, 1] = 60; a[0, 2] = 70; a[1, 0] = 80; a[1, 1] = 90; a[1, 2] = 100; for (int i = 0; i < 2; i++) { for (int j = 0; j < 3; j++) Console.Write(" " + a[i, j]); Console.WriteLine(); } Console.WriteLine("press any key to exit"); Console.ReadLine(); } } }

11

Name: Tanmay Baid Roll Number: 0829cs071112

Output:

12

Name: Tanmay Baid Roll Number: 0829cs071112 /* 5. WAP to print jagged array and also find the number of rows and number of columns in each row.*/ using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication7 { class Demo { static void Main(string[] args) { int[][] a = new int[2][]; a[0] = new int[] { 89,94,46,54,64 }; a[1] = new int[] {12,56}; for (int i = 0; i < a.Length; i++) { for (int j = 0; j < a[i].Length;j++) Console.Write(" " + a[i][j]); Console.WriteLine(); } Console.WriteLine("no of rows=" +a.Length); Console.WriteLine("no of column in first row=" + a[0].Length); Console.WriteLine("no of column in second row=" + a[1].Length); Console.WriteLine("\npress any key to exit"); Console.ReadLine(); } } }

13

Name: Tanmay Baid Roll Number: 0829cs071112

Output:

14

Name: Tanmay Baid Roll Number: 0829cs071112 // 6. WAP to find sum of two number using function. using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication8 { class Sumof { static void Main(string[] args) { int a, b; Console.Write("Enter 1st Number "); a = int.Parse(Console.ReadLine()); Console.Write("Enter 2nd Number "); b = int.Parse(Console.ReadLine()); int c = sum(a, b); Console.WriteLine("Sum of " + a + " & " + b + " is =" + c); Console.ReadLine(); } static int sum(int a, int b) { int c = a + b; return c; } } }

15

Name: Tanmay Baid Roll Number: 0829cs071112

Output:

16

Name: Tanmay Baid Roll Number: 0829cs071112 // 7. WAP to show how static data member works in a class. using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication9 { class A { static int n; public void Get(int x) { n = x; } public void Show() { Console.WriteLine("n=" + n); } } class sta_tic { static void Main() { A a = new A(); a.Get(99); a.Show(); A b = new A(); b.Get(200); b.Show(); a.Show(); Console.ReadLine(); } } }

17

Name: Tanmay Baid Roll Number: 0829cs071112

Output:

18

Name: Tanmay Baid Roll Number: 0829cs071112 /*8. WAP to check whether the two entered string are equal or not using string class and its methods. also find the length of each string.*/ using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication10 { class Demo { public static void Main(string[] args) { string s = "Check"; string t = "Check"; if (s.Equals(t)) Console.WriteLine("Strings are Same"); else Console.WriteLine("String are Different"); Console.WriteLine("Length of the string s is= " + s.Length); Console.ReadLine(); } } }

19

Name: Tanmay Baid Roll Number: 0829cs071112

Output:

20

Name: Tanmay Baid Roll Number: 0829cs071112 // 9. WAP to show how we can use structure in a class. using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication11 { struct Student { int rollno; string name; public void SetData(int r, string n) { rollno = r; name = n; } public void ShowData() { Console.WriteLine("ROLL NO=:" + rollno); Console.WriteLine("Name=:" + name); } } class struc { static void Main(string[] args) { Student s = new Student(); s.SetData(52, "Tanmay Baid"); s.ShowData(); Console.ReadLine(); } } }

21

Name: Tanmay Baid Roll Number: 0829cs071112

Output:

22

Name: Tanmay Baid Roll Number: 0829cs071112 // 10. WAP to show how structure variable works differently than class variable (object). using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication12 { struct Student { int rollno; string name; public void SetData(int r, string n) { rollno = r; name = n; } public void ShowData() { Console.WriteLine(rollno + " " + name); } } class strt { static void Main(string[] args) { Student s = new Student(); s.SetData(1, "Enrique"); s.ShowData(); Student t = s; // values of s will be copied into t t.ShowData(); t.SetData(2, "Atif"); // s will not change t.ShowData(); s.ShowData(); Console.ReadLine(); } } }

23

Name: Tanmay Baid Roll Number: 0829cs071112

Output:

24

Name: Tanmay Baid Roll Number: 0829cs071112 // 11. WAP to show how we can pass object as an argument to a function. using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication13 { class Student { int rollno; string name; public void SetData(int r, string n) { rollno = r; name = n; } public void ShowData() { Console.WriteLine(rollno + " " + name); } public void SetData(Student a) { rollno = a.rollno; name = a.name; } } class Demo { static void Main(string[] args) { Student s = new Student(); s.SetData(1, "Shirlee"); s.ShowData(); Student t = new Student(); t.SetData(s); t.ShowData(); t.SetData(2, "Robin"); // s will not change t.ShowData(); s.ShowData(); Console.ReadLine(); } } }

25

Name: Tanmay Baid Roll Number: 0829cs071112

Output:

26

Name: Tanmay Baid Roll Number: 0829cs071112 // 12. WAP that will work like copy constructor of c++. using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication14 { class Student { int rollno; string name; public void SetData(int r, string n) { rollno = r; name = n; } public void ShowData() { Console.WriteLine(rollno + " " + name); } } class Demo { static void Main(string[] args) { Student s = new Student(); s.SetData(1, "Gabriel"); s.ShowData(); Student t = s;// t will point to s t.ShowData(); t.SetData(2, "Rohinton");// s will also be changed t.ShowData(); s.ShowData(); Console.ReadLine(); } } }

27

Name: Tanmay Baid Roll Number: 0829cs071112

Output:

28

Name: Tanmay Baid Roll Number: 0829cs071112 // 13. WAP that contains different classes but no inheritance. using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication15 { class A { public void Show() { Console.WriteLine("Show A"); } } class B { public void Show() { Console.WriteLine("Show B"); } } class Demo { static void Main(string[] args) { A a = new A(); a.Show(); B b = new B(); b.Show(); Console.ReadLine(); } } }

29

Name: Tanmay Baid Roll Number: 0829cs071112

Output:

30

Name: Tanmay Baid Roll Number: 0829cs071112 // 14. WAP to inherit base class into derived class (no method overriding). using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication16 { class A { public void Say() { Console.WriteLine("say A"); } public void Write() { Console.WriteLine("write A"); } } class B : A { public void Say() { Console.WriteLine("say B"); } public void Call() { Console.WriteLine("Call B"); } } class Demo { static void Main(string[] args) { A a = new A(); Console.WriteLine("Langston Hughes"); a.Say(); a.Write(); //a.call(); // call() not accessible by A's abject Console.WriteLine("*Octavia Butler"); B b = new B(); b.Say(); b.Write(); b.Call(); Console.WriteLine("--when (a=b)--"); a = b; 31

Name: Tanmay Baid Roll Number: 0829cs071112 a.Say(); a.Write(); // a.Call(); // we cant call call() bcozz it is not defined by A class Console.ReadLine(); } } }

32

Name: Tanmay Baid Roll Number: 0829cs071112

Output:

33

Name: Tanmay Baid Roll Number: 0829cs071112 // 15. WAP to show polymorphism using virtual and override keyword . using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication17 { class A { public virtual void Show() { Console.WriteLine("Show A"); } public virtual void Fun() { Console.WriteLine("Fun A"); } } class B : A { public override void Show() { Console.WriteLine("Show B"); } public void Call() { Console.WriteLine("Call B"); } } class Demo { static void Main(string[] args) { A a = new A(); Console.WriteLine("***X***"); a.Show(); a.Fun(); //a.Call(); // call() not accessible by A's abject B b = new B(); Console.WriteLine("***Y***"); b.Show(); b.Fun(); b.Call(); a = b; Console.WriteLine("***when(a=b)***"); 34

Name: Tanmay Baid Roll Number: 0829cs071112 a.Show(); a.Fun(); // a.Call(); // we cant call call() bcozz it is not defined by A class Console.ReadLine(); } } }

35

Name: Tanmay Baid Roll Number: 0829cs071112

Output:

36

Name: Tanmay Baid Roll Number: 0829cs071112 // 16. WAP to show how we can use abstract class and abstract method. using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication18 { abstract class A { public virtual void Show() { Console.WriteLine("Show A"); } public virtual void Fun() { Console.WriteLine("Fun A"); } public abstract void Call(); } class B : A { public override void Show() { Console.WriteLine("Show B"); } public override void Call() { Console.WriteLine("Call B"); } } class Demo { static void Main(string[] args) { B b = new B(); Console.WriteLine("----B----"); b.Show(); b.Fun(); b.Call(); A a = b; Console.WriteLine("----(A=B)----"); a.Show(); a.Fun(); a.Call(); Console.ReadLine(); } 37

Name: Tanmay Baid Roll Number: 0829cs071112 } } Output:

38

Name: Tanmay Baid Roll Number: 0829cs071112 // 17. WAP to show multiple inheritance using class and interface. using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication19 { class A { public virtual void Show() { Console.WriteLine("Show A"); } public void Disp() { } } interface Z { void Call(); } class B : A, Z { public override void Show() { Console.WriteLine("Show B"); } public void Call() { Console.WriteLine("Call B"); } } class Demo { static void Main(string[] args) { B b = new B(); Console.WriteLine("----B---"); b.Show(); // will call show() of B class b.Call(); // will call call() of B class A a = b; Console.WriteLine("---(A=B)--"); a.Show(); // will call show() of B class Console.ReadLine(); } } }

39

Name: Tanmay Baid Roll Number: 0829cs071112

Output:

40

Name: Tanmay Baid Roll Number: 0829cs071112 // 18. WAP to avoid inheritance of particular method. using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication20 { class A { public virtual void Show() { Console.WriteLine("Show A"); } } class B : A { public sealed override void Show() { Console.WriteLine("Show B"); } } class C : B { public override void Show() // Error :sealed method in B cant be override { Console.WriteLine("Show B"); } } class Demo { static void Main(string[] args) { B b = new B(); A a = b; a.Show(); Console.ReadLine(); } } }

41

Name: Tanmay Baid Roll Number: 0829cs071112

// 19. WAP to show how we can use enumeration to define symbolic constants for color. using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication21 { class Colors { enum Color { Voilet, Green, Blue, } static void Main(string[] args) { string buffer; Color myColor; Console.WriteLine("Violet=0"); Console.WriteLine("Green=1"); Console.WriteLine("Blue=2"); Console.WriteLine("Enter a value for a color:"); buffer = Console.ReadLine(); myColor = (Color)Convert.ToInt32(buffer); switch (myColor) { case Color.Voilet: System.Console.WriteLine("\nYour choise of colour is:..."); break; case Color.Green: System.Console.WriteLine("\nYour choise of colour is..."); break; case Color.Blue: System.Console.WriteLine("\nYour choise of colour is..."); break; default: System.Console.WriteLine("\nYour choise of colour is..."); break; } 42

Name: Tanmay Baid Roll Number: 0829cs071112 System.Console.WriteLine("\n {0} ({1})", myColor, (int)myColor); Console.WriteLine("thanks!!"); Console.Read(); } } } Output: Output for Blue:

Output for Green:

43

Name: Tanmay Baid Roll Number: 0829cs071112

/* 20. WAP to show how we can use enumeration to define symbolic constants for on/off (1,0) values.*/ using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication22 { class TTT { public enum Mode { off, on } static void Main(string[] args) { Mode ob; Console.WriteLine("enter 0 or 1"); string str = Console.ReadLine(); ob = (Mode)Convert.ToByte(str); if (ob == Mode.off) Console.WriteLine("off"); 44

Name: Tanmay Baid Roll Number: 0829cs071112 else if (ob == Mode.on) Console.WriteLine("on"); else Console.WriteLine("invalid number"); Console.ReadLine(); } } }

Output: Output for ON Condition:

45

Name: Tanmay Baid Roll Number: 0829cs071112

Output for OFF Condition:

/* 21. WAP to print name and surname from command line.*/

46

Name: Tanmay Baid Roll Number: 0829cs071112

Output:

47

Name: Tanmay Baid Roll Number: 0829cs071112

/* 22. WAP to find sum and average of n numbers entered by user using foreach loop.*/ using using using using

System; System.Collections.Generic; System.Linq; System.Text;

namespace ConsoleApplication24 { class Program { static void Main(string[] args) { int n, y; float sum = 0; float avg;

48

Name: Tanmay Baid Roll Number: 0829cs071112 Console.WriteLine("Enter value of n: "); String no = Console.ReadLine(); n = Convert.ToInt32(no); int[] nums = new int[n]; Console.WriteLine("Enter value in array: "); for (int i = 0; i < n; i++) { Console.WriteLine("Enter value: "); String z = Console.ReadLine(); y = Convert.ToInt32(z); nums[i] = y; } foreach (int x in nums) { Console.WriteLine("Value is: " + x); sum = sum + x; } Console.WriteLine("Summation is: " + sum); avg = sum / n; Console.WriteLine("Avreage is: " + avg); Console.ReadLine(); } } }

Output:

49

Name: Tanmay Baid Roll Number: 0829cs071112

/* 23. Create a Windows form to calculate compound interest and print the result on message box.*/ 50

Name: Tanmay Baid Roll Number: 0829cs071112 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication8 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { int p, t, r, si; { p = Convert.ToInt32(textBox1.Text); r = Convert.ToInt32(textBox2.Text); t = Convert.ToInt32(textBox3.Text); si = (p * t * r) / 100; MessageBox.Show("Interest is"+si); } } } }

51

Name: Tanmay Baid Roll Number: 0829cs071112 Output:

52

Name: Tanmay Baid Roll Number: 0829cs071112 /* 24. Create a windows form to show stored data in sql server database on form using GridView control.*/ using using using using using using using using using

System; System.Collections.Generic; System.ComponentModel; System.Data; System.Drawing; System.Linq; System.Text; System.Windows.Forms; System.Data.SqlClient;

namespace WindowsFormsshowdataGridview { public partial class Form1 : Form { SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=Atif;Integrated Security=True;Pooling=False"); SqlDataAdapter da = new SqlDataAdapter(); DataSet ds = new DataSet(); public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { ds.Clear(); string str = "select * from Employ"; da = new SqlDataAdapter(str, con); da.Fill(ds); dataGridView1.DataSource = ds.Tables[0]; } } } 53

Name: Tanmay Baid Roll Number: 0829cs071112

Output:

54

Name: Tanmay Baid Roll Number: 0829cs071112

/* 25. Create a windows form to insert student information in table named “STU”.*/ using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace stuinformation { public partial class Form1 : Form { SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=Atif;Integrated Security=True;Pooling=False"); SqlDataAdapter da = new SqlDataAdapter(); DataSet ds = new DataSet(); SqlCommandBuilder cmb; public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e){ } private void Insert_Click(object sender, EventArgs e) { ds.Clear(); string str = "Select * from Stu"; SqlDataAdapter da = new SqlDataAdapter(str, con); da.Fill(ds); cmb = new SqlCommandBuilder(da); DataRow dr = ds.Tables[0].NewRow(); dr[0] = textBox1.Text; dr[1] = textBox2.Text; dr[2] = textBox6.Text; 55

Name: Tanmay Baid Roll Number: 0829cs071112 dr[3] = textBox3.Text; dr[4] = textBox4.Text; dr[5] = textBox5.Text; ds.Tables[0].Rows.Add(dr); da.Update(ds); MessageBox.Show("Record insert"); } } } Output:

56

Name: Tanmay Baid Roll Number: 0829cs071112

/* 26. Create a windows MDI form, add Menu on it and link it to various dialogs, forms.*/ using using using using using using using using

System; System.Collections.Generic; System.ComponentModel; System.Data; System.Drawing; System.Linq; System.Text; System.Windows.Forms;

namespace WindowsFormsApplication2 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void editToolStripMenuItem_Click(object sender, EventArgs e) { } private void openToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal); openFileDialog.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"; if (openFileDialog.ShowDialog(this) == DialogResult.OK) 57

Name: Tanmay Baid Roll Number: 0829cs071112 { string FileName = openFileDialog.FileName; } } private void newToolStripMenuItem_Click(object sender, EventArgs e) { Form2 f = new Form2(); f.MdiParent = this; f.Show(); } private void saveToolStripMenuItem_Click(object sender, EventArgs e) { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal); saveFileDialog.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"; if (saveFileDialog.ShowDialog(this) == DialogResult.OK) { string FileName = saveFileDialog.FileName; } } private void solutionToolStripMenuItem_Click(object sender, EventArgs e) { } private void newWindowToolStripMenuItem_Click(object sender, EventArgs e) { Form2 childForm = new Form2(); childForm.MdiParent = this; childForm.Text = "Window " + childFormNumber++; childForm.Show(); } } }

58

Name: Tanmay Baid Roll Number: 0829cs071112

Output:

59

Name: Tanmay Baid Roll Number: 0829cs071112

/* 27. Create HTML form using notepad and print “Hello Html” in explore.*/

60

Name: Tanmay Baid Roll Number: 0829cs071112

Output:

61

Name: Tanmay Baid Roll Number: 0829cs071112

/* 28. Create an asp.net page to show use of various standard controls.*/

62

Name: Tanmay Baid Roll Number: 0829cs071112

/* 29. Create an asp.net page for new registration and insert record in sql database. Show the inserted records on another page.*/ 63

Name: Tanmay Baid Roll Number: 0829cs071112 using using using using using using using using using using using using

System; System.Configuration; System.Data; System.Linq; System.Web; System.Web.Security; System.Web.UI; System.Web.UI.HtmlControls; System.Web.UI.WebControls; System.Web.UI.WebControls.WebParts; System.Xml.Linq; System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page { SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=Atif;Integrated Security=True;Pooling=False"); SqlDataAdapter da = new SqlDataAdapter(); DataSet ds = new DataSet(); protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { string str="insert into Registation values('"+TextBox1 .Text +"','"+TextBox2 .Text +"','"+TextBox3 .Text +"','"+TextBox4 .Text +"','"+TextBox5 .Text +"','"+TextBox6 .Text +"','"+TextBox7 .Text +"')"; SqlCommand cmd = new SqlCommand(str, con); cmd .Connection .Open (); cmd .ExecuteNonQuery (); cmd .Connection .Close (); Response.Write("Record insert"); } }

64

Name: Tanmay Baid Roll Number: 0829cs071112 Output:

65

Name: Tanmay Baid Roll Number: 0829cs071112 /* 30. Create an asp.net page to show use of various validation controls.*/

66

Name: Tanmay Baid Roll Number: 0829cs071112

/* 31. Create an asp.net page to display random image using AdRotator control and XML file.*/ 1317.jpg http//www.yahoo.com adsfdgfgf Lithia Park, Ashland, Oregon - 1600x1200 - ID 12.jpg http//www.yahoo.com adsfdgfgf



67

Name: Tanmay Baid Roll Number: 0829cs071112

Output:

68

Name: Tanmay Baid Roll Number: 0829cs071112

/* 32. Create an asp.net page to show use of Web User Control.*/ <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <%@ Register TagPrefix ="CS" TagName ="P1" Src ="~/WebUserControl.ascx" %> Untitled Page


69

Name: Tanmay Baid Roll Number: 0829cs071112

Output:

70

Name: Tanmay Baid Roll Number: 0829cs071112

/* 33. Create an asp.net page to allow update, edit, delete option on GridView control.*/

71

Name: Tanmay Baid Roll Number: 0829cs071112

/* 34. Create and apply .css(Cascading Style Sheet) file.*/ body, td, th { font-size: 11px; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: gray; } body { margin-left: 50px; margin-top: 50px; margin-right: 10px; margin-bottom: 10px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color:#000000; } A:link { color: Blue; text-decoration: none; } 72

Name: Tanmay Baid Roll Number: 0829cs071112 A:visited { text-decoration: none; color: Pink; } A:active { text-decoration: none; color: Black; } A:hover { text-decoration: underline; color: white; } BUTTON { font-size: 9pt; color: white; font-family: 'Book Antiqua' , Verdana; background-color: #7f5f72; }

Output:

73

Name: Tanmay Baid Roll Number: 0829cs071112

/* 35. Create and apply .skin (Theme) file.*/

74

Name: Tanmay Baid Roll Number: 0829cs071112 <%-Default skin template. The following skins are provided as examples only. 1. Named control skin. The SkinId should be uniquely defined because duplicate SkinId's per control type are not allowed in the same theme. 2. Default skin. The SkinId is not defined. Only one default control skin per control type is allowed in the same theme. --%>

75

Name: Tanmay Baid Roll Number: 0829cs071112 Output:

76

Related Documents

Dot Net Programs
May 2020 17
Dot Net
December 2019 31
Dot Net
November 2019 27
Dot Net
May 2020 23
Dot Net
August 2019 35

More Documents from "Pidikiti Surendra Babu"