Esempio n. 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["user"] == null)
     {
         Response.Redirect("index.aspx");
     }
     else
     {
         u = (Users)Session["user"];
     }
     if (!IsPostBack)
     {
         ddlLanMu.DataSource     = Lanmu.getLanMuList();
         ddlLanMu.DataTextField  = "lanMuName";
         ddlLanMu.DataValueField = "lanMuId";
         ddlLanMu.DataBind();
         if (Request.QueryString["id"] != null)
         {
             string id = Request.QueryString["id"].ToString();
             News   n  = News.getNewsById(id);
             txtTitle.Text  = n.title;
             content1.Value = n.contents;
             foreach (ListItem x in ddlLanMu.Items)
             {
                 if (x.Value == n.lanMuId.ToString())
                 {
                     x.Selected = true;
                 }
             }
         }
     }
 }
 public void showLanMuList()
 {
     gvLanMu.DataSource = Lanmu.getLanMuList();
     gvLanMu.DataBind();
 }