protected void btnupload_Click(object sender, EventArgs e)
        {
            try
            {
                newsflash_GetallTableAdapter newsflash_insert = new newsflash_GetallTableAdapter();
                string content = taNews.Value.Replace("'", "''");
                if (hdnId.Value.Length > 0)
                {
                    int? id = Int32.Parse(hdnId.Value);
                    newsflash_insert.Update_NewsFlash(content, DateTime.Now, id);
                    Server.Transfer("editnewsflash.aspx");
                }
                else
                {
                    k = newsflash_insert.Insert(DateTime.Now, content);

                    if (k > 0)
                    {
                        Response.Write("<script>alert('Newsflash Uploded Successfully')</script>");
                    }
                }
            }
            catch (Exception ex)
            {
                lblstatus.Text = ex.Message;
            }
        }
 protected void newsGrid_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     GridView gv = sender as GridView;
     GridViewRow row = gv.Rows[e.RowIndex];
     int? id = Int32.Parse(row.Cells[1].Text);
     newsflash_GetallTableAdapter adptr = new newsflash_GetallTableAdapter();
     adptr.newsflash_delete(id);
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     newsflash_GetallTableAdapter adptr = new newsflash_GetallTableAdapter();
     newsGrid.DataSource = adptr.GetnewsflashDescription();
     newsGrid.DataBind();
     newsGrid.HeaderRow.Cells[1].Visible = false;
     newsGrid.HeaderRow.Cells[3].Visible = false;
     foreach (GridViewRow gvr in newsGrid.Rows)
     {
         gvr.Cells[1].Visible = false;
         gvr.Cells[3].Visible = false;
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     editnewsflash epage = Context.Handler as editnewsflash;
     if (epage != null)
     {
         hdnId.Value = epage.Id;
     }
     if (hdnId.Value.Length > 0)
     {
         int? id = Int32.Parse(hdnId.Value);
         if (btnupload.Text != "Update")
         {
             newsflash_GetallTableAdapter adptr = new newsflash_GetallTableAdapter();
             newsflash.newsflash_GetallRow news = adptr.GetNewFlash(id).Rows[0] as newsflash.newsflash_GetallRow;
             taNews.Value = news.Newsflash;
             btnupload.Text = "Update";
         }
     }
 }
 protected void updatenewsflash(object sender, EventArgs e)
 {
     newsflash_GetallTableAdapter dtgetall = new newsflash_GetallTableAdapter();
     dtgetall.Update(ddlyear.SelectedValue, ddlmonth.SelectedValue, Editor1.Content);
     newsflash_GetDescriptionTableAdapter descr = new newsflash_GetDescriptionTableAdapter();
     DataTable dtgetupdate = descr.GetDatanewsflash();
     Label lblnewsflash = (Label)FindControlRecursive(Page, "lblnewsflash");
     if (dtgetupdate.Rows.Count > 0)
     {
         string desc = dtgetupdate.Rows[0]["Newsflash"].ToString();
         lblnewsflash.Text = desc;
     }
 }