Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     editID = Request.QueryString["id"];
     if (!IsPostBack)
     {
         ddCategory.DataValueField = "Id";
         ddCategory.DataTextField  = "Title";
         ddCategory.DataSource     = categoryBusiness.FetchAll().ToList();
         ddCategory.DataBind();
         if (!String.IsNullOrEmpty(editID))
         {
             var editNews = newsBusiness.GetByID(long.Parse(editID));
             txtTitle.Text            = editNews.Title;
             txtDate.Text             = editNews.Date.ToString();
             txtDesc.Text             = editNews.Description;
             ddCategory.SelectedValue = editNews.CategoryID.ToString();
             editImage = editNews.Image;
         }
     }
 }
Exemplo n.º 2
0
 private void RefreshGridView()
 {
     gvCategory.DataSource = categoryBusiness.FetchAll().ToList();
     gvCategory.DataBind();
 }