Reply Write.aspx |
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Write.aspx.cs" Inherits="Reply_Write" %> <!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> <h3><asp:Literal ID="ltrTitle" runat="server" <div> 이름: <asp:TextBox ID="txtName" runat="server" /><br /> 이메일: <asp:TextBox ID="txtEmail" runat="server" /><br /> 홈페이지: <asp:TextBox ID="txtHomepage" runat="server" /><br /> 제목: <asp:TextBox ID="txtTitle" runat="server" /><br /> 내용: <asp:TextBox ID="txtContent" runat="server" </asp:TextBox><br /> 인코딩: <asp:RadioButtonList ID="lstEncoding" runat="server" RepeatLayout="Flow"> <asp:ListItem Selected="True">Text</asp:ListItem> <asp:ListItem>HTML</asp:ListItem> <asp:ListItem>Mixed</asp:ListItem> </asp:RadioButtonList> <br /> 비밀번호: <asp:TextBox ID="txtPassword" runat="server" <br /> <asp:Button ID="btnWrite" runat="server" onclick="btnWrite_Click" /> <asp:HyperLink ID="btnList" runat="server" </div> </div> </form> </body> </html> |
Reply Write.Cs |
using System; using Reply.Entity; using Reply.Bsl; public partial class Reply_Write : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { // Mode=Reply 식으로 Mode값이 널/빈 값이 아니라면, 답변하기 로직 적용 if (!String.IsNullOrEmpty(Request["Mode"])) { ltrTitle.Text = "답변달기"; btnWrite.Text = "글 답변"; if (!Page.IsPostBack) { DisplayData(); } } } private void DisplayData() { // 부모글의 제목과 내용을 텍스트박스에 바인딩 ReplyEntity re = (new ReplyBiz()).SelectReplyByNum this.txtTitle.Text = "Re : " + re.Title; // 부모글의 Re : 붙여서 출력 this.txtContent.Text = "\r\n\r\n--------------------\r\n>" + re.Content.Replace("\r\n", "\r\n>") + "\r\n--------------------\r\n"; } protected void btnWrite_Click(object sender, EventArgs e) { ReplyEntity re = new ReplyEntity(); re.Name = txtName.Text; re.Email = txtEmail.Text; re.Homepage = txtHomepage.Text; re.Title = txtTitle.Text; re.PostIP = Request.UserHostAddress; re.Content = txtContent.Text; re.Encoding = lstEncoding.SelectedValue; re.Password = txtPassword.Text; if (!String.IsNullOrEmpty(Request["Mode"]) && Request { // 답변 로직 처리 : 두번째 매개변수가 부모글의 번호(ParentNUm)로 저장 (new ReplyBiz()).InsertReply(re, Convert.ToInt32(Request["Num"])); } else { // 저장 로직 처리 ReplyBiz rb = new ReplyBiz(); rb.InsertReply(re); } string strJs = @" <script>alert('입력되었습니다.'); "; Page.ClientScript.RegisterClientScriptBlock } } |
'.Net Project > ASP.NET 3.5 Sp1' 카테고리의 다른 글
41-7장 답변형 게시판(Modify) (0) | 2009.10.27 |
---|---|
41-6장 답변형 게시판(List) (0) | 2009.10.27 |
40장 ASP.NET Web 로그인 컨트롤 (Login Name) (0) | 2009.10.15 |
39장 ASP.NET Web 로그인컨트롤 (Login Status) (0) | 2009.10.15 |
38장 ASP.NET Web 로그인 컨트롤 (Password Recovery, Changed Recovery) (0) | 2009.10.15 |