textbox.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="textbox.aspx.cs" Inherits="our_program.textbox" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>name and address</title>
<center><h1>name and address separate textbox</h1></center>
</head>
<body>
<form id="form1" runat="server">
<center>
<div>
<asp:TextBox ID="txt1" runat="server"></asp:TextBox>
<br />
<br />
<asp:TextBox ID="txt2" runat="server" TextMode="MultiLine" Rows="5" Columns="15"></asp:TextBox>
<br />
<br />
<asp:DropDownList ID="ddl1" runat="server" >
<asp:ListItem Selected>--select Gender--</asp:ListItem>
<asp:ListItem Value="Male">Male</asp:ListItem>
<asp:ListItem Value="Female">female</asp:ListItem>
</asp:DropDownList>
<br />
<br />
<asp:DropDownList ID="ddl2" runat="server">
<asp:ListItem>--select district--</asp:ListItem>
<asp:ListItem Value="Malappuram" Text="Malappuram"></asp:ListItem>
<asp:ListItem Value="Calicut" Text="Calicut"></asp:ListItem>
<asp:ListItem Value="Palakkad" Text="Palakkad"></asp:ListItem>
<asp:ListItem Value="Kollam" Text="Kollam"></asp:ListItem>
<asp:ListItem Value="Kasarkod" Text="Kasarkod"></asp:ListItem>
</asp:DropDownList>
<br />
<asp:Button ID="btn" runat="server" onclick="btn_Click" Text="submit"/>
<br />
<asp:Label ID="lbl1" runat="server" Text="name"></asp:Label>
<br />
<br/>
<asp:Label ID="lbl2" runat="server" Text="address" ></asp:Label>
<br />
<br/>
<asp:Label ID="lbl3" runat="server" Text="Gender" ></asp:Label>
<br />
<br/>
<asp:Label ID="lbl4" runat="server" Text="district" ></asp:Label>
</div>
</center>
</form>
</body>
</html>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="textbox.aspx.cs" Inherits="our_program.textbox" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>name and address</title>
<center><h1>name and address separate textbox</h1></center>
</head>
<body>
<form id="form1" runat="server">
<center>
<div>
<asp:TextBox ID="txt1" runat="server"></asp:TextBox>
<br />
<br />
<asp:TextBox ID="txt2" runat="server" TextMode="MultiLine" Rows="5" Columns="15"></asp:TextBox>
<br />
<br />
<asp:DropDownList ID="ddl1" runat="server" >
<asp:ListItem Selected>--select Gender--</asp:ListItem>
<asp:ListItem Value="Male">Male</asp:ListItem>
<asp:ListItem Value="Female">female</asp:ListItem>
</asp:DropDownList>
<br />
<br />
<asp:DropDownList ID="ddl2" runat="server">
<asp:ListItem>--select district--</asp:ListItem>
<asp:ListItem Value="Malappuram" Text="Malappuram"></asp:ListItem>
<asp:ListItem Value="Calicut" Text="Calicut"></asp:ListItem>
<asp:ListItem Value="Palakkad" Text="Palakkad"></asp:ListItem>
<asp:ListItem Value="Kollam" Text="Kollam"></asp:ListItem>
<asp:ListItem Value="Kasarkod" Text="Kasarkod"></asp:ListItem>
</asp:DropDownList>
<br />
<asp:Button ID="btn" runat="server" onclick="btn_Click" Text="submit"/>
<br />
<asp:Label ID="lbl1" runat="server" Text="name"></asp:Label>
<br />
<br/>
<asp:Label ID="lbl2" runat="server" Text="address" ></asp:Label>
<br />
<br/>
<asp:Label ID="lbl3" runat="server" Text="Gender" ></asp:Label>
<br />
<br/>
<asp:Label ID="lbl4" runat="server" Text="district" ></asp:Label>
</div>
</center>
</form>
</body>
</html>
textbox.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace our_program
{
public partial class textbox : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btn_Click(object sender, EventArgs e)
{
string a = txt1.Text;
string b = txt2.Text;
string c = ddl1.SelectedValue.ToString();
string d = ddl2.SelectedValue.ToString();
lbl1.Text = "name is "+a.ToString();
lbl2.Text = "address is "+b.ToString();
lbl3.Text = "Gender is " + c.ToString();
lbl4.Text = "district is " + d.ToString();
}
}
}
No comments:
Post a Comment