protected void TextBoxInit()
        {
            userinfo user = new userinfo();

            switch (message)
            {
            case "0":       //发布新闻
            {
                Label1.Text = "发布新闻";
                break;
            }

            case "1":      //修改新闻
            {
                Label1.Text = "修改新闻";
                DataTable table = user.showNewsPer(Session["newsidqwer"].ToString());
                if (table.Rows.Count > 0)
                {
                    TextBox1.Text = table.Rows[0]["head"].ToString();
                    TextBox2.Text = "    " + table.Rows[0]["con"].ToString();
                }
                else
                {
                    this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('无此记录!');</script>");
                }
                break;
            }
            }
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Session["jgmndnewsid"] = Request.QueryString["id"];
            DataTable table = user.showNewsPer(Session["jgmndnewsid"].ToString());

            if (table.Rows.Count > 0)
            {
                this.Label1.Text = table.Rows[0]["head"].ToString();
                this.Label3.Text = " " + table.Rows[0]["author"].ToString();
                TextBox2.Text    = "    " + table.Rows[0]["con"].ToString();
            }
        }