FrmButton (버튼)
.NET프로그래밍/ASP.NET 3.5 SP1 2009. 10. 6. 11:16 |
==> [FrmButton.aspx] 소스 및 디자인
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="FrmButton.aspx.cs" Inherits="FrmButton" %>
<!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></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="txtNum" runat="server" Text="0"></asp:TextBox>
<asp:Button ID="btnUp" runat="server" Text="증가" onclick="btnUp_Click" />
<asp:Button ID="btnDown" runat="server" Text="감소" onclick="btnDown_Click" />
</div>
</form>
</body>
</html>
-------------------------------------------------------------------------------------
==> [FrmButton.aspx.cs] 소스
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class FrmButton : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
// 증가버튼에 대한 클릭이벤트
protected void btnUp_Click(object sender, EventArgs e)
{
txtNum.Text = Convert.ToString(Convert.ToInt32(txtNum.Text) + 1);
}
// 감소버튼에 대한 클릭이벤트
protected void btnDown_Click(object sender, EventArgs e)
{
txtNum.Text = Convert.ToString(Int32.Parse(txtNum.Text) - 1);
}
}
-------------------------------------------------------------------------------------
[실행결과]
'.NET프로그래밍 > ASP.NET 3.5 SP1' 카테고리의 다른 글
FrmLinkButton (0) | 2009.10.07 |
---|---|
FrmLiteral (0) | 2009.10.07 |
FrmTextBox (텍스트박스) (0) | 2009.10.06 |
FrmLabel (레이블) (0) | 2009.10.06 |
FrmLabelTextBoxButton(레이블 / 텍스트박스 / 버튼) (0) | 2009.10.06 |