wt_lab7

2
LAB EXERCISE - 7 Q1: Implementation of Standard Controls Webform1.aspx.cs using System.*; using System.Collections.Generic; using System.Web.UI; using System.Web.UI.WebControls; namespace WebApplication1 { public partial class WebForm1 : System.Web.UI.Page { String str; protected void Button1_Click(object sender, EventArgs e) { Session["fname"] = TextBox1.Text; Session["lname"] = TextBox2.Text; if (rab1.Checked) { Session["gender"] = rab1.Text; } else if(rab2.Checked) { Session["gender"] = rab2.Text; } if (cb1.Checked) { str = cb1.Text; Session["quali"] = str; } if (cb2.Checked) { str += " , " + cb2.Text; Session["quali"] = str; } if (cb3.Checked) { str += " , " + cb3.Text; Session["quali"] = str; } if (cb4.Checked) { str += " , " + cb4.Text; Session["quali"] = str; } Server.Transfer("WebForm2.aspx"); } } } Webform2.aspx.cs using System.*; using System.Collections.Generic; using System.Web.UI; using System.Web.UI.WebControls; namespace WebApplication1

Upload: kuku288

Post on 11-Dec-2015

212 views

Category:

Documents


0 download

DESCRIPTION

lb7

TRANSCRIPT

Page 1: WT_lab7

LAB EXERCISE - 7

Q1: Implementation of Standard Controls

Webform1.aspx.cs

using System.*;

using System.Collections.Generic;

using System.Web.UI;

using System.Web.UI.WebControls;

namespace WebApplication1

{ public partial class WebForm1 : System.Web.UI.Page

{ String str;

protected void Button1_Click(object sender, EventArgs e)

{ Session["fname"] = TextBox1.Text;

Session["lname"] = TextBox2.Text;

if (rab1.Checked)

{ Session["gender"] = rab1.Text; }

else if(rab2.Checked)

{ Session["gender"] = rab2.Text; }

if (cb1.Checked)

{ str = cb1.Text;

Session["quali"] = str; }

if (cb2.Checked)

{ str += " , " + cb2.Text;

Session["quali"] = str; }

if (cb3.Checked)

{ str += " , " + cb3.Text;

Session["quali"] = str; }

if (cb4.Checked)

{ str += " , " + cb4.Text;

Session["quali"] = str; }

Server.Transfer("WebForm2.aspx");

} } }

Webform2.aspx.cs

using System.*;

using System.Collections.Generic;

using System.Web.UI;

using System.Web.UI.WebControls;

namespace WebApplication1

Page 2: WT_lab7

{ public partial class WebForm2 : System.Web.UI.Page

{ protected void Page_Load(object sender, EventArgs e)

{ Label1.Text = Session["fname"].ToString();

Label2.Text = Session["lname"].ToString();

Label3.Text = Session["gender"].ToString();

Label4.Text = Session["quali"].ToString();

}}}