ReplyView.aspx |
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="View.aspx.cs" <!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> <script type="text/javascript"> function GoModify() { location.href = 'Modify.aspx?Num=<%= Request["Num"] %>'; } </script> </head> <body> <form id="form1" runat="server"> <div> <h3>상세보기</h3> <div> 번호 : <asp:Label ID="lblNum" runat="server" /><br /> 제목 : <asp:Label ID="lblTitle" runat="server" /><br /> 이름 : <asp:Label ID="lblName" runat="server" /><br /> 이메일 : <asp:Label ID="lblEmail" runat="server" /><br /> 홈페이지 : <asp:Label ID="lblHomepage" runat="server" /><br /> 작성일 : <asp:Label ID="lblPostDate" runat="server" /><br /> 수정일 : <asp:Label ID="lblModifyDate" runat="server" /><br /> 조회수 : <asp:Label ID="lblReadCount" runat="server" /><br /> IP주소 : <asp:Label ID="lblPostIP" runat="server" /><br /> <asp:Label ID="lblContent" runat="server" /><br /> <br /> <!-- 서버 컨트롤 사용 --> <asp:Button ID="btnReply" runat="server" Text="답변" <!-- OnClientScrip 사용 --> <asp:Button ID="btnModify" runat="server" Text="수정" <!-- HTML로 삭제 버튼 생성 --> <input type="button" value="삭제" onclick="location.href='<%= <!-- HTML로 리스트로 이동하는 버튼 생성--> <input type="button" value="리스트" </div> </div> </form> </body> </html> |
ReplyView.Cs |
using System; using Reply.Entity; using Reply.Bsl; public partial class Reply_View : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (String.IsNullOrEmpty(Request["Num"])) { Response.Write("잘못된 요청"); Response.End(); } else { if (!Page.IsPostBack) { DisplayData(); } } }
{ // 메서드 실행 후 그 결과값을 ReplyEntity 엔티티 개체에 담기 ReplyEntity re = (new Reply.Bsl.ReplyBiz()).SelectReplyByNum // 각각의 컨트롤에 바인딩 lblNum.Text = Request["Num"]; lblTitle.Text = re.Title; lblName.Text = re.Name; lblEmail.Text = re.Email; lblHomepage.Text = re.Homepage; lblPostDate.Text = re.PostDate.ToString(); // 수정 되었을 때에만, 해당 날짜 기록 if (re.ModifyDate != DateTime.MinValue) { lblModifyDate.Text = re.ModifyDate.ToString(); } lblReadCount.Text = re.ReadCount.ToString(); lblPostIP.Text = re.PostIP; #region 인코딩 방식에 따른 컨텐츠 출력 lblContent.Text = Reply.Common.Board.ConvertContentByEncoding // Common 폴더에 메서드화 //if (re.Encoding == "Text") // 태그 실행 방지/소스 그대로 //{ // lblContent.Text = re.Content.Replace("&", "&").Replace("<", "<").Replace(">", ">").Replace("\r\n", "<br />").Replace("\t", " "); //} //else if (re.Encoding == "Mixed") // 태그 실행 //{ // lblContent.Text = re.Content.Replace("\r\n", "<br />"); //} //else // HTML로 표시 //{ // lblContent.Text = re.Content; //} #endregion } protected void btnReply_Click(object sender, EventArgs e) { // Mode=Reply로 Write.aspx 페이지로 넘어가면, 답변 로직 처리 Response.Redirect("Write.aspx?Mode=Reply&Num=" + Request["Num"]); } protected void btnModify_Click(object sender, EventArgs e) { Response.Redirect("Modify.aspx?Num=" + Request["Num"]); } } |
'.Net Project > ASP.NET 3.5 Sp1' 카테고리의 다른 글
41-10장 답변형 게시판(Common) (0) | 2009.10.27 |
---|---|
41-9장 답변형 게시판(Delete) (0) | 2009.10.27 |
41-7장 답변형 게시판(Modify) (0) | 2009.10.27 |
41-6장 답변형 게시판(List) (0) | 2009.10.27 |
41-5장 답변형 게시판(Write) (0) | 2009.10.27 |