protected void Button1_Click(object sender, EventArgs e) { try { Panel1.Visible = true; int eid; string q; Button btnRespond = (Button)(sender); GridViewRow gRow = (GridViewRow)(btnRespond.Parent.Parent); eid = int.Parse(gRow.Cells[1].Text); Enquiryid.Text = "Enquiry ID: " + eid.ToString(); q = "select * from tbl_Enquiry where Enquiry_id='" + eid + "';"; DBAdmin db = new DBAdmin(); DataTable dt = new DataTable(); dt = db.ReadBulkData(q); emailid = dt.Rows[0][2].ToString(); //Session["kid"] = emailid; Label2.Text = emailid; } catch (Exception ex) { } }
protected void myCall() { DataTable dt = dB.ReadBulkData("select * from Tbl_Discuss"); threadTxt.Text = dt.Rows[0][0].ToString(); askTxt.Text = dt.Rows[0][1].ToString(); quesTxt.Text = dt.Rows[0][2].ToString(); notxt.Text = dt.Rows[0][3].ToString(); int count = dt.Columns.Count; int i = 4; if (count > 4) { while (count > 4) { Label ans = new Label(); ans.Font.Bold = true; Label anstxt = new Label(); anstxt.CssClass = "anstext"; ansPanel.Controls.Add(ans); ansPanel.Controls.Add(anstxt); ans.Text = "Answer No." + (i - 3) + " ->"; anstxt.Text = " " + dt.Rows[0][i].ToString() + "<br/>"; i++; count--; } } else { Label label = new Label(); Page.Controls.Add(label); label.Text = "No Answers yet"; } }
protected void Button1_Click(object sender, EventArgs e) { DBAdmin db = new DBAdmin(); DataTable dt = db.ReadBulkData("select * from Tbl_Registration"); gviewallrecords.DataSource = dt; gviewallrecords.DataBind(); }
protected void ddlcategory_SelectedIndexChanged(object sender, EventArgs e) { string category = ddlcategory.SelectedItem.Text; if (category == "Web Technology") { MView.SetActiveView(viewWT); DBAdmin db = new DBAdmin(); DataTable dt = db.ReadBulkData("select * from Tbl_Uploadmaterial where category='" + category + "'"); GviewWT.DataSource = dt; GviewWT.DataBind(); } if (category == "Programming") { MView.SetActiveView(viewPro); DBAdmin db = new DBAdmin(); DataTable dt = db.ReadBulkData("select * from Tbl_Uploadmaterial where category='" + category + "'"); GviewPro.DataSource = dt; GviewPro.DataBind(); } if (category == "Database") { MView.SetActiveView(viewDB); DBAdmin db = new DBAdmin(); DataTable dt = db.ReadBulkData("select * from Tbl_Uploadmaterial where category='" + category + "'"); GviewDB.DataSource = dt; GviewDB.DataBind(); } if (category == "Operating System") { MView.SetActiveView(viewOS); DBAdmin db = new DBAdmin(); DataTable dt = db.ReadBulkData("select * from Tbl_Uploadmaterial where category='" + category + "'"); GviewOS.DataSource = dt; GviewOS.DataBind(); } if (category == "Computer Organisation And Architecture") { MView.SetActiveView(viewCOA); DBAdmin db = new DBAdmin(); DataTable dt = db.ReadBulkData("select * from Tbl_Uploadmaterial where category='" + category + "'"); GviewCOA.DataSource = dt; GviewCOA.DataBind(); } if (category == "Fundamental of Computers") { MView.SetActiveView(viewFOC); DBAdmin db = new DBAdmin(); DataTable dt = db.ReadBulkData("select * from Tbl_Uploadmaterial where category='" + category + "'"); GviewFOC.DataSource = dt; GviewFOC.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { Panel1.Visible = false; string q; q = "select * from tbl_enquiry "; DBAdmin dm = new DBAdmin(); DataTable dt = new DataTable(); dt = dm.ReadBulkData(q); if (dt.Rows.Count > 0) { GridView2.DataSource = dt; GridView2.DataBind(); } else { Response.Write("<script>alert('Record Not Found')</script>"); } }
protected void btnLogin_Click(object sender, EventArgs e) { string username, password, c, q; username = txtUsername.Text; password = txtPassword.Text; c = DropDownList1.Text; q = "select * from TBL_login where user_id='" + username + "'and pass='******'and user_type='" + c + "'"; DBAdmin dm = new DBAdmin(); DataTable dt = new DataTable(); dt = dm.ReadBulkData(q); if (dt.Rows.Count > 0) { if (dt.Rows[0][2].ToString().Trim().Equals("User")) { if (dt.Rows[0][3].ToString().Trim().Equals("Active")) { Session["uid"] = username; Response.Redirect("~/USERSEGMENT/UserHome.aspx"); } else { Response.Write("<script>alert('Account disable Contact to Administrator ')</script>"); } } else { Session["uid"] = username; Response.Redirect("~/ADMINSEGMENT/Home.aspx"); } } else { Response.Write("<script>alert('Invalid Userid and Password')</script>"); } }
protected void Button2_Click(object sender, EventArgs e) { try { Button btnRespond = (Button)(sender); GridViewRow gRow = (GridViewRow)(btnRespond.Parent.Parent); Enquiryid.Text = gRow.Cells[1].Text; string q; q = "delete from tbl_enquiry where Enquiry_id='" + Enquiryid.Text + "'"; DBAdmin dm = new DBAdmin(); dm.IUD(q); DataTable dt = new DataTable(); dt = dm.ReadBulkData("select * from tbl_enquiry"); if (dt.Rows.Count > 0) { GridView2.DataSource = dt; GridView2.DataBind(); } } catch (Exception ex) { } }
protected void myCall() { DataTable dt = dB.ReadBulkData("select * from Tbl_Discuss"); int r = dt.Rows.Count; int c = dt.Columns.Count; for (int i = 0; i < r; i++) { Panel main = new Panel();//main Panel main.ID = "MainPanel" + i.ToString(); main.CssClass = "MainPanel"; Master.FindControl("CPHBox2").Controls.Add(main); Panel panel = new Panel(); //Questions and 1st half Panel panel.ID = "panel1" + i.ToString(); panel.CssClass = "panel1"; //CSS class of panel1 main.Controls.Add(panel); Panel reply = new Panel(); reply.ID = "ReplyPanel" + i.ToString(); reply.Visible = false; //It will appear after click of button only reply.Attributes.Add("class", "reply"); //panel for replying main.Controls.Add(reply); //creating divs for whole page here only..... HtmlGenericControl division = new HtmlGenericControl("DIV"); //thread div division.Attributes.Add("class", "quesdiv"); HtmlGenericControl usernamediv = new HtmlGenericControl("DIV"); // asked by div usernamediv.Attributes.Add("class", "userNameDiv"); HtmlGenericControl quesdiv = new HtmlGenericControl("DIV"); //question div quesdiv.Attributes.Add("class", "quesDiv"); HtmlGenericControl countdiv = new HtmlGenericControl("DIV"); //reply count div countdiv.Attributes.Add("class", "countDiv"); HtmlGenericControl replybtndiv = new HtmlGenericControl("DIV"); //reply Button div replybtndiv.Attributes.Add("class", "replybtnDiv"); HtmlGenericControl textdiv = new HtmlGenericControl("DIV"); //textbox div textdiv.Attributes.Add("class", "textDiv"); HtmlGenericControl buttondiv = new HtmlGenericControl("DIV"); //button div buttondiv.Attributes.Add("class", "buttonDiv"); //adding all div in ques panel.............. panel.Controls.Add(division); panel.Controls.Add(usernamediv); panel.Controls.Add(quesdiv); panel.Controls.Add(countdiv); reply.Controls.Add(textdiv); reply.Controls.Add(buttondiv); panel.Controls.Add(replybtndiv); Label threadlbl = new Label(); threadlbl.CssClass = "threadlbl"; threadlbl.Text = "Thread Id .........."; division.Controls.Add(threadlbl); Label threadtxt = new Label(); threadtxt.CssClass = "threadtxt"; threadtxt.Text = dt.Rows[i][0].ToString() + " <br/>"; division.Controls.Add(threadtxt); Label asklbl = new Label(); asklbl.Text = "Asked By: "; usernamediv.Controls.Add(asklbl); Label asktxt = new Label(); asktxt.Text = dt.Rows[i][1].ToString() + " <br/>"; usernamediv.Controls.Add(asktxt); Label qtxt = new Label(); qtxt.CssClass = "qtxt"; qtxt.Text = dt.Rows[i][2].ToString() + " <br/>"; quesdiv.Controls.Add(qtxt); Label nolbl = new Label(); nolbl.Text = "Total Replies....."; countdiv.Controls.Add(nolbl); Label notxt = new Label(); notxt.Text = dt.Rows[i][3].ToString() + " <br/>"; countdiv.Controls.Add(notxt); Button replyButton = new Button(); replyButton.ID = "replybtn" + i.ToString(); replyButton.Text = "Make a Reply"; replyButton.CssClass = "replybtn"; replybtndiv.Controls.Add(replyButton); replyButton.Click += delegate(object sender, EventArgs e) { replyButton_Click(sender, e, i); }; //replyButton.Click += new EventHandler(replyButton_Click); //reply panel code from here............. TextBox text = new TextBox(); text.CssClass = "textbox"; text.TextMode = TextBoxMode.MultiLine; text.Height = 100; text.Width = 500; textdiv.Controls.Add(text); Button post = new Button(); post.CssClass = "post"; post.Text = "Post Your Answer"; buttondiv.Controls.Add(post); //ans Panel code from here...................... Panel ansPanel = new Panel(); ansPanel.ID = "panel2" + i.ToString(); ansPanel.CssClass = "panel2"; ansPanel.Visible = false; main.Controls.Add(ansPanel); int a; Int32.TryParse(dt.Rows[i][3].ToString(), out a); if (a > 0) { for (int j = 4; j < c; j++) { Label ans = new Label(); ansPanel.Controls.Add(ans); ans.Text = "Answer No" + (j - 3) + " " + dt.Rows[i][j].ToString() + "<br/>"; } } else { Label ans = new Label(); ansPanel.Controls.Add(ans); ans.Text = "No Answers for this Post as Yet <br/>Be the First one To Answer <br/>"; } } }
protected void Page_Load(object sender, EventArgs e) { GridView1.DataSource = db.ReadBulkData("select * from tbl_UploadMaterial"); GridView1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { Session["uid"] = "Admin"; userlbl.Text = Session["uid"].ToString(); DataTable dt = dB.ReadBulkData("select Thread, Student_id, Question, Ans_count from tbl_Discuss"); }
protected void myCall() { DataTable dt = dB.ReadBulkData("select * from Tbl_Discuss"); int r = dt.Rows.Count; int c = dt.Columns.Count; for (int i = 0; i < r; i++) { Panel panel = new Panel(); Page.Controls.Add(panel); panel.BackColor = System.Drawing.Color.Aqua; Label threadlbl = new Label(); threadlbl.Text = "Thread Id "; panel.Controls.Add(threadlbl); Label threadtxt = new Label(); threadtxt.Text = dt.Rows[i][0].ToString() + " <br/>"; panel.Controls.Add(threadtxt); Label asklbl = new Label(); asklbl.Text = "Asked By: "; panel.Controls.Add(asklbl); Label asktxt = new Label(); asktxt.Text = dt.Rows[i][1].ToString() + " <br/>"; panel.Controls.Add(asktxt); Label qlbl = new Label(); qlbl.Text = "Question "; panel.Controls.Add(qlbl); Label qtxt = new Label(); qtxt.Text = dt.Rows[i][2].ToString() + " <br/>"; panel.Controls.Add(qtxt); Label nolbl = new Label(); nolbl.Text = "No of Replies"; panel.Controls.Add(nolbl); Label notxt = new Label(); notxt.Text = dt.Rows[i][3].ToString() + " <br/>"; panel.Controls.Add(notxt); for (int j = 4; j < c; j++) { Panel ansPanel = new Panel(); if (dt.Rows[i][j].ToString().Length > 0) { Label ans = new Label(); ansPanel.Controls.Add(ans); ans.Text = "Answer No " + (j - 3) + " " + dt.Rows[i][j].ToString() + "<br/>"; } } } //while (c>0) //{ // //threadlbl.Text = "Thread Id "; // //threadTxt.Text=dt.Rows[][] //} //threadTxt.Text = dt.Rows[0][0].ToString(); //askTxt.Text = dt.Rows[0][1].ToString(); //quesTxt.Text = dt.Rows[0][2].ToString(); //notxt.Text = dt.Rows[0][3].ToString(); //int count = dt.Columns.Count; //int i = 4; //if (count > 4) //{ // while (count > 4) // { // Label ans = new Label(); // Page.Controls.Add(ans); // ans.Text = "Answer No " + (i - 3) + " " + dt.Rows[0][i].ToString() + "<br/>"; // i++; // count--; // } //} //else //{ // Label label = new Label(); // Page.Controls.Add(label); // label.Text = "No Answers yet"; //} }