IsPostBackEvent.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="IsPostBackEvent.aspx.cs" Inherits="ASPNETALL.IsPostBackEvent" %>
<!DOCTYPE html>
<html
xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<strong>First Name : </strong>
<asp:TextBox ID="txtFNM" runat="server"></asp:TextBox>
<br />
<strong>Last Name :
<asp:TextBox ID="txtLNM" runat="server"></asp:TextBox>
<br />
City : </strong>
<asp:DropDownList ID="ddlCity" runat="server" Height="16px" Width="116px">
</asp:DropDownList>
<br />
<asp:Label ID="lblMsg" runat="server" Font-Bold="True" ForeColor="Red" Text="lblMessage"></asp:Label>
<br />
<asp:Button ID="btnReg" runat="server" OnClick="btnReg_Click" Text="Registration" />
</div>
</form>
</body>
</html>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="IsPostBackEvent.aspx.cs" Inherits="ASPNETALL.IsPostBackEvent" %>
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="txtFNM" runat="server"></asp:TextBox>
<br />
<strong>Last Name :
<asp:TextBox ID="txtLNM" runat="server"></asp:TextBox>
<br />
City : </strong>
<asp:DropDownList ID="ddlCity" runat="server" Height="16px" Width="116px">
</asp:DropDownList>
<br />
<asp:Label ID="lblMsg" runat="server" Font-Bold="True" ForeColor="Red" Text="lblMessage"></asp:Label>
<br />
<asp:Button ID="btnReg" runat="server" OnClick="btnReg_Click" Text="Registration" />
</form>
</body>
</html>
using System;
public partial class IsPostBackEvent : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
if (!IsPostBack)
LoadCityDropDownLIst();
}
}
public void LoadCityDropDownLIst()
ListItem li1 = new ListItem("Uttar Pradesh");
}
protected void btnReg_Click(object sender, EventArgs e)
lblMsg.Text = "Your Name= " + txtFNM.Text.Trim() + " " + txtLNM.Text.Trim() + " and City= " + ddlCity.SelectedItem.ToString() + "";
}
}
0 comments
Post a Comment