Пример #1
0
        private void BindZhanbao()
        {
            DataTable dt = ZhanbaoManager.SelectTop(5);

            if (dt != null && dt.Rows.Count != 0)
            {
                Repeater1.DataSource = dt;
                Repeater1.DataBind();
            }
        }
Пример #2
0
 protected void btnNoticeUp_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtTitle.Text) || string.IsNullOrEmpty(txtContent.Text))
     {
         Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('请输入信息后再点击!');</script>");
     }
     else
     {
         Model.Zhanbao ns = new Model.Zhanbao();
         ns.Z_Title   = txtTitle.Text;
         ns.Z_Time    = System.DateTime.Now;
         ns.Z_Content = txtContent.Text;
         if (ZhanbaoManager.AddZhanbao(ns) == 1)
         {
             Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('新闻上传成功!');</script>");
             Response.Redirect("index.aspx");
         }
     }
 }