毕业论文

打赏
当前位置: 毕业论文 > 计算机论文 >

ASP.net网络信息发布系统设计与实现+ER图+流程图(11)

时间:2016-12-08 20:03来源:毕业论文
GridView1.DataKeyNames = new string[] { id }; GridView1.DataBind(); } protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) { GridView1.PageIndex = e.NewPageIndex; bind();


        GridView1.DataKeyNames = new string[] { "id" };
        GridView1.DataBind();
    }
    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView1.PageIndex = e.NewPageIndex;
        bind();
    }
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string id = GridView1.DataKeys[e.RowIndex].Value.ToString();
        string sSql = "delete News where id=" + id;
        SQL s = new SQL();
        bool result = s.SqlResults(sSql);
        if (result == true)
        {
            Page.RegisterStartupScript("alert", "<script>alert('删除成功!');</script>");
        }
        else
        {
            Page.RegisterStartupScript("alert", "<script>alert('删除失败!');</script>");
        }
        bind();
    }
    protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {
        string id=GridView1.DataKeys[e.NewEditIndex].Value.ToString();
        Response.Redirect("News_checkdate.aspx?id=" + id);
    }
}
4.5信息审核设计及实现
为了保证发布信息的安全性、完整性、可靠性,系统中设计了信息审核的模块,对信息的标题、内容进行审核,审核通过后才能对信息进行发布,工浏览者浏览、阅读以及评论。如图4.7所示。
 
图4.7 信息审核页面
点击“审核”进入审核界面,审核信息标题、内容后点击审核通过即可,如图4.8所示。

图4.8信息审核页面

此功能实现的关键代码如下:
public partial class Manage_News_checkdate : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            TextBox3.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            bind();
        }
    }
    private void bind()
    {
        string sSql = "select * from News where id="+Request["id"].ToString();
        SQL s = new SQL();
        DataView dv = s.DSSearch(sSql).Tables[0].DefaultView;
        TextBox1.Text = dv[0].Row["Title"].ToString();
        TextBox2.Text = dv[0].Row["Contents"].ToString();
    }
    protected void Button1_Click(object sender, EventArgs e) ASP.net网络信息发布系统设计与实现+ER图+流程图(11):http://www.youerw.com/jisuanji/lunwen_760.html
------分隔线----------------------------
推荐内容