<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
<asp:Button ID="Button1" runat="server" OnCommand="Navigate_Command" Text="<<" CommandName="First" Width="65px"/>
<asp:Button ID="Button2" runat="server" OnCommand="Navigate_Command" Text="<" CommandName="Previous" Width="65px"/>
<asp:Button ID="Button3" runat="server" OnCommand="Navigate_Command" Text=">" CommandName="Next" Width="65px"/>
<asp:Button ID="Button4" runat="server" OnCommand="Navigate_Command" Text=">>" CommandName="Last" Width="65px"/>
</form>
</body>
</html>
using System;
using System.Web.UI.WebControls;
using System.Drawing;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Navigate_Command(object sender, CommandEventArgs e)
{
switch (e.CommandName)
{
case "First":
Response.Write("First");
break;
case "Previous":
Response.Write("Previous");
break;
case "Next":
Response.Write("Next");
break;
case "Last":
Response.Write("Last");
break;
}
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1
{
width: 103px;
}
.auto-style3
{
width: 165px;
}
.auto-style4
{
width: 143px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<table style="width: 76%;">
<tr>
<td class="auto-style1">
<asp:Label ID="Label1" runat="server" Text="Label">EmployeeName</asp:Label>
</td>
<td class="auto-style4">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
<td class="auto-style3"> </td>
</tr>
<tr>
<td class="auto-style1">
<asp:Label ID="Label2" runat="server" Text="Label">Password</asp:Label>
</td>
<td class="auto-style4">
<asp:TextBox ID="TextBox2" runat="server" TextMode="Password"> </asp:TextBox>
</td>
<td class="auto-style3"> </td>
</tr>
<tr>
<td class="auto-style1">
<asp:Label ID="Label3" runat="server" Text="Label">Address</asp:Label>
</td>
<td class="auto-style4">
<asp:TextBox ID="TextBox3" runat="server" Height="54px" TextMode="MultiLine" Width="211px"></asp:TextBox>
</td>
<td class="auto-style3"> </td>
</tr>
<tr>
<td class="auto-style1">
<asp:Button ID="Button1" runat="server" Text="Button" />
</td>
<td class="auto-style4">
<asp:LinkButton ID="LinkButton1" runat="server">Submit</asp:LinkButton>
</td>
<td class="auto-style3">
<asp:ImageButton ID="ImageButton1" runat="server" AlternateText="This is Image Button" ImageUrl="~/logo.gif" BorderColor="Blue" BorderStyle="Solid" BorderWidth="2px" PostBackUrl="~/Default2.aspx" />
</td>
</tr>
</table>
</form>
</body>
</html>
using System;
public partial class EmployeeForm : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
string Name ="Name: "+ txtName.Text;
string Email ="Email: "+ txtEmailID.Text;
string Gender="" ;
if(RDBmale.Checked)
{
Gender ="Gender: "+ RDBmale.Text;
}
if (RDBfemale.Checked)
{
Gender = "Gender: " + RDBfemale.Text;
}
string Cities = "";
if(chbAgra.Checked)
{
Cities +=chbAgra.Text+"\n";
}
if (chbDelhi.Checked)
{
Cities += chbDelhi.Text + "\n";
}
if (chbPune.Checked)
{
Cities += chbPune.Text + "\n";
}
string Address ="Address:"+ txtAddress.Text;
txtResult.Text = Name + "\n" + Email+"\n"+Gender+"\n"+"City: "+Cities +"\n" +Address;
}
protected void btnCancel_Click(object sender, EventArgs e)
{
txtName.Text = String.Empty;
txtPassword.Text = String.Empty;
txtAddress.Text = String.Empty;
txtEmailID.Text = String.Empty;
RDBfemale.Checked = false;
RDBmale.Checked = false;
chbPune.Checked = false;
chbAgra.Checked = false;
chbDelhi.Checked = false;
txtResult.Text= String.Empty;
}
}
Field | Control | ID |
Name | TextBox | txtName |
Password | TextBox | txtPassword |
TextBox | txtEmailID | |
Gender | RadioButton | RDBmale |
Prefered Cities | CheckBox | chbDelhi |
Current Address | Multiline TextBox | txtAddress |
Submit | Button | btnSubmit |
Cancel | Button | btnCancel |