반응형
Button 컨트롤에 관련된 예제입니다.
FrmButton.aspx |
<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> |
FrmButton.aspx.cs |
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); } |
결과화면 |
[그림18-1] |
반응형
'ASP.NET' 카테고리의 다른 글
20.C# ASP.NET - 링크버튼(LinkButton) 컨트롤 [WebStandardControl] (0) | 2009.10.07 |
---|---|
19.C# ASP.NET - Literal 컨트롤 [WebStandardControl] (0) | 2009.10.07 |
17.C# ASP.NET - TextBox 컨트롤 [WebStandardControl] (0) | 2009.10.06 |
16.C# ASP.NET - Lable 컨트롤 [WebStandardControl] (0) | 2009.10.06 |
15.C# ASP.NET - Lable, TextBox, Button 컨트롤 [WebStandardControl] (0) | 2009.10.06 |
Comments