0% found this document useful (0 votes)
63 views3 pages

Lab Exercise - 7: Q1: Implementation of Standard Controls

This document contains code for a webform application that implements standard controls to transfer user input data between pages using session variables. On the first page, textboxes store the user's first and last name, radio buttons store their gender, and checkboxes store their qualifications which are combined into a string and stored in a session variable. The second page retrieves and displays this stored data from the session variables on labels when the page loads.

Uploaded by

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

Lab Exercise - 7: Q1: Implementation of Standard Controls

This document contains code for a webform application that implements standard controls to transfer user input data between pages using session variables. On the first page, textboxes store the user's first and last name, radio buttons store their gender, and checkboxes store their qualifications which are combined into a string and stored in a session variable. The second page retrieves and displays this stored data from the session variables on labels when the page loads.

Uploaded by

kuku288
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

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
{ 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();
}}}

You might also like