Пример #1
0
    // gridView에 data bind 해주는 부분
    protected void Page_Load(object sender, EventArgs e)
    {
        BoardDAO boarddao = new BoardDAO();

        this.dateOrderSQL   = "";
        this.writerOrderSQL = "";
        this.titleOrderSQL  = "";


        if (!IsPostBack)
        {
            this.dateOrderSQL = "board_date DESC";

            this.writerOrderSQL = "";
            this.titleOrderSQL  = "";

            this.isSelectDelete = false;


            this.numberPage = 10;
            this.pageNum    = 1;
            reader          = (DataTable)ViewState["boards"];
            if (reader == null)
            {
                reader = boarddao.selectAll();
                ViewState["boards"] = reader;
            }

            setBoardList();
        }
    }
Пример #2
0
    // 제목 정렬 선택하면 수행되는 함수
    protected void ddlTitleOrder_SelectedIndexChanged(object sender, EventArgs e)
    {
        String titleOption = ddlTitleOrder.SelectedValue;

        // 제목
        if (titleOption == "-1")
        {
            this.titleOrderSQL = "";
        }

        // 가나다순
        if (titleOption == "0")
        {
            BoardDAO boarddao = new BoardDAO();
            this.titleOrderSQL = "board_title ASC";

            String order = setOrder();
            reader = boarddao.selectAll(order);
            ViewState["boards"] = reader;
            setBoardList();
        }
    }
Пример #3
0
    // 날짜 정렬 선택하면 수행되는 함수
    protected void ddlDateOrder_SelectedIndexChanged(object sender, EventArgs e)
    {
        String dateOption = ddlDateOrder.SelectedValue;

        // 날짜
        if (dateOption == "-1")
        {
            this.dateOrderSQL = "";
        }

        // 최신순
        if (dateOption == "0")
        {
            BoardDAO boarddao = new BoardDAO();
            this.dateOrderSQL = "board_date DESC";

            String order = setOrder();
            reader = boarddao.selectAll(order);
            ViewState["boards"] = reader;

            setBoardList();
        }

        //오래된 순
        if (dateOption == "1")
        {
            BoardDAO boarddao = new BoardDAO();
            this.dateOrderSQL = "board_date ASC";

            String order = setOrder();
            reader = boarddao.selectAll(order);
            ViewState["boards"] = reader;

            setBoardList();
        }
    }