블로그 이미지
Magic_kit
study 관련자료를 한곳으로 자기 개발 목적으로 재태크 재무 관리 목적으로 일상생활의 팁을 공유 하기 위하여 블로그를 개설 하였습니다.

calendar

1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28

Category

Recent Post

Recent Comment

Archive

2009. 10. 27. 02:31 .Net Project/ASP.NET 3.5 Sp1
반응형
ReplyView.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="View.aspx.cs"
         Inherits
="Reply_View" %>

 

<!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="답변" 
                 onclick
="btnReply_Click" />

           

            <!-- OnClientScrip 사용 -->

            <asp:Button ID="btnModify" runat="server" Text="수정"
                 onclick
="btnModify_Click" />

           

            <!-- HTML 삭제 버튼 생성 -->

            <input type="button" value="삭제" onclick="location.href='<%
                        "Delete.aspx?Num=" + Request["Num"] %>
';" />

           

            <!-- HTML 리스트로 이동하는 버튼 생성-->

            <input type="button" value="리스트"
                        onclick
="location.href='List.aspx';" />

        </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();

            }

        }

    }


   
private void DisplayData()

    {

        // 메서드 실행 결과값을 ReplyEntity 엔티티 개체에 담기

        ReplyEntity re =

            (new Reply.Bsl.ReplyBiz()).SelectReplyByNum
                                       (
Convert.ToInt32(Request["Num"]));

       

        // 각각의 컨트롤에 바인딩

        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
                          (re.Content, re.Encoding);

 

        // Common 폴더에 메서드화

        //if (re.Encoding == "Text") // 태그 실행 방지/소스 그대로

        //{

        //    lblContent.Text = re.Content.Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;").Replace("\r\n", "<br />").Replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;");

        //}

        //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"]);

    }

} 







반응형
posted by Magic_kit