Example #1
0
    //更新编辑后的帖子
    protected void editBtn_Click(object sender, EventArgs e)
    {
        //更新编辑后帖子(内容、时间)
        localhost.Service service = new localhost.Service();

        //Request.QueryString.GetValues(0)[0]获取上一页面中点击“站点文化”的id
        int state = service.AlterNote(Convert.ToInt32(Request.QueryString.GetValues(0)[0]), titleTbx.Text.ToString(), txtContent.Text.ToString());

        if (state == 1)
        {
            lblMsg.Text = "更新成功!";

            //更新时间
        }


        //将更新成功后的信息展现在我们的页面上
        DataSet titleListDS = service.GetTitle(Convert.ToInt32(Request.QueryString.GetValues(0)[0]));
        //
        DataRowView mydrview = titleListDS.Tables["TitleList"].DefaultView[0];

        //更新内容
        txtContent.Text = Convert.ToString(mydrview.Row["noteContent"]);
        //更新标题
        titleTbx.Text = Convert.ToString(mydrview.Row["noteTitle"]);
    }