protected void Page_Load(object sender, EventArgs e) { categories = Category.GetAllCategoryNames(); //display pages in navbar SqlConnection con1 = new SqlConnection(ConfigurationManager.ConnectionStrings["globaldb"].ConnectionString); pages = Page_class.ReadPagesFromDB(); //check cookies for logged in user if any cookie = Request.Cookies["ejas_login"]; if (cookie != null) { lblHelloText.Text = "Hello " + cookie["username"]; btnLoginb.Text = "Logout"; } else { lblHelloText.Text = "Hello Guest"; btnLoginb.Text = "Login"; } //retrieving website title, tagline and company String q1 = "select * from websitedetails"; SqlCommand com1 = new SqlCommand(q1, con1); con1.Open(); SqlDataReader rdr = com1.ExecuteReader(); while (rdr.Read()) { webiste_title = rdr["WebsiteName"].ToString(); tagline = rdr["tagline"].ToString(); company = rdr["Company"].ToString(); url = rdr["url"].ToString(); about = rdr["about"].ToString(); fb = rdr["FacebookPage"].ToString(); twitter = rdr["TwitterTimeline"].ToString(); github = rdr["Github"].ToString(); } con1.Close(); //retrieving archives months q1 = "select distinct CONVERT(CHAR(4), DateCreated, 100) + CONVERT(CHAR(4), DateCreated, 120) from posts"; com1 = new SqlCommand(q1, con1); con1.Open(); rdr = com1.ExecuteReader(); while (rdr.Read()) { months.Add(rdr[0].ToString()); } con1.Close(); if (IsPostBack) { return; } Plugin.LoadAssemblies(); }
protected void Button1_Click(object sender, EventArgs e) { int published = 0; if (drpPublish.SelectedIndex == 0) { published = 1; } else { published = 0; } Page_class page = new Page_class(txtTitle.Text.Replace("'", "''"), published); page.SavePage(txtContent.Text.Replace("'", "''")); }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { return; } string pageid = Request.QueryString["pageid"]; page = Page_class.GetPagebyID(pageid); globaldata.PageContents = Page_class.GetTextofPage(page.pageName); txtTitle.Text = globaldata.PageContents[1]; txtContent.Text = globaldata.PageContents[3]; if (page.published == 1) { drpPublish.SelectedIndex = 0; } else { drpPublish.SelectedIndex = 1; } txtSelectedIndex.Text = drpPublish.SelectedIndex.ToString(); }