示例#1
0
        protected void Edit_Click(object sender, EventArgs e)
        {
            Button btn  = (Button)sender;
            string id   = btn.ID;
            int    x    = id.LastIndexOf("_");
            string trid = id.Substring(x + 1);

            //LblResult.Text += " : trid " + trid;

            TopicID.Value = trid;

            TableRow  tr = (TableRow)TableTopic.FindControl(trid);
            TableCell c1 = (TableCell)TableTopic.FindControl(trid + "c1");
            TableCell c2 = (TableCell)TableTopic.FindControl(trid + "c2");
            TableCell c3 = (TableCell)TableTopic.FindControl(trid + "c3");
            TableCell c4 = (TableCell)TableTopic.FindControl(trid + "c4");
            TableCell c5 = (TableCell)TableTopic.FindControl(trid + "c5");

            Button addE = new Button();

            addE.Text     = "SAVE";
            addE.CssClass = "button";
            //addE.Click += addE_Click;
            addE.OnClientClick = "return EditFunction();";

            addE.ID = "addE_" + trid;

            //LblResult.Text = "C2Text : " + TableTopic.FindControl(trid).ID;

            string c2Text, c3Text, c4Text;

            c2Text = c2.Text;
            c3Text = c3.Text;
            c4Text = c4.Text;

            c2.Text = "";
            c3.Text = "";
            c4.Text = "";
            c5.Controls.RemoveAt(0);
            c5.Controls.RemoveAt(0);

            TextBox TextBoxTopicName = new TextBox();
            TextBox TextBoxTopicID   = new TextBox();
            TextBox TextBoxDisplay   = new TextBox();

            TextBoxTopicName.CssClass = "txtBox";
            TextBoxTopicID.CssClass   = "txtBox";
            TextBoxDisplay.CssClass   = "txtBox";

            TextBoxTopicName.Text = c2Text;
            TextBoxTopicID.Text   = c3Text;

            if (c4Text == "Hidden")
            {
                TextBoxDisplay.Text = "0";
            }
            else
            {
                TextBoxDisplay.Text = "1";
            }

            c5.Controls.Add(addE);

            TextBoxTopicName.ID = "TextBoxTopicNameE";
            TextBoxTopicID.ID   = "TextBoxTopicIDE";
            TextBoxDisplay.ID   = "TextBoxDisplayE";

            c2.Controls.Add(TextBoxTopicName);
            c3.Controls.Add(TextBoxTopicID);
            c4.Controls.Add(TextBoxDisplay);

            //bool l = BusinessLogic.UpdateTopic(1, 10, "ssss", "ssss");
            //addE_Click(sender, e);
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (Session["CurrentUser"] == null)
            //{
            //    Response.Redirect("~/default.aspx");
            //}

            if (IsPostBack && Event.Value == "edit")
            {
                addE_Click(sender, e);
            }


            DataTable dt = BusinessLogic.GetTableTopics();

            if (dt.Rows.Count > 0)
            {
                for (int i = dt.Rows.Count - 1; i >= 0; i--)
                {
                    int    TopicID     = Convert.ToInt32(dt.Rows[i]["TopicID"]);
                    int    Display     = Convert.ToInt32(dt.Rows[i]["display"]);
                    string Topic       = dt.Rows[i]["Topic"].ToString();
                    string TopicPageID = dt.Rows[i]["TopicPageID"].ToString();
                    Button Edit        = new Button();
                    Button Del         = new Button();

                    TableRow  tr = new TableRow();
                    TableCell c1 = new TableCell();
                    TableCell c2 = new TableCell();
                    TableCell c3 = new TableCell();
                    TableCell c4 = new TableCell();
                    TableCell c5 = new TableCell();

                    tr.ID = TopicID.ToString();
                    c1.ID = tr.ID + "c1";
                    c2.ID = tr.ID + "c2";
                    c3.ID = tr.ID + "c3";
                    c4.ID = tr.ID + "c4";
                    c5.ID = tr.ID + "c5";

                    //LblResult.Text += " : " + tr.ID;

                    Edit.Text = "Edit";
                    Del.Text  = "Delete";

                    Edit.ID       = "Edit_" + TopicID.ToString();
                    Del.ID        = "Del_" + TopicID.ToString();
                    Edit.CssClass = Del.CssClass = "button";

                    Del.Click  += Del_Click;
                    Edit.Click += Edit_Click;


                    c1.CssClass = "TableCell";
                    c2.CssClass = "TableCell";
                    c3.CssClass = "TableCell";
                    c4.CssClass = "TableCell";
                    c5.CssClass = "TableCell";

                    c1.Text = TopicID.ToString();
                    c2.Text = Topic;
                    c3.Text = TopicPageID;

                    if (Display == 0)
                    {
                        c4.Text = "Hidden";
                    }
                    else
                    {
                        c4.Text = "Visible";
                    }

                    c5.Controls.Add(Edit);
                    c5.Controls.Add(Del);

                    tr.Controls.Add(c1);
                    tr.Controls.Add(c2);
                    tr.Controls.Add(c3);
                    tr.Controls.Add(c4);
                    tr.Controls.Add(c5);

                    TableTopic.Controls.Add(tr);

                    Control cont = TableTopic.FindControl(tr.ID);

                    //if (cont == null)
                    //{
                    //    LblResult.Text += " tr " + tr.ID + " :: Not ";
                    //}
                    //else
                    //{
                    //    LblResult.Text += " tr " + tr.ID + " :: Yes ";
                    //}
                }
            }
        }
示例#3
0
        protected void Edit_Click(object sender, EventArgs e)
        {
            Button btn  = (Button)sender;
            string id   = btn.ID;
            int    x    = id.LastIndexOf("_");
            string trid = id.Substring(x + 1);

            //LblResult.Text += " : trid " + trid;

            Challange.Value = trid;

            TableRow  tr = (TableRow)TableTopic.FindControl(trid);
            TableCell c1 = (TableCell)TableTopic.FindControl(trid + "c1");
            TableCell c2 = (TableCell)TableTopic.FindControl(trid + "c2");
            TableCell c3 = (TableCell)TableTopic.FindControl(trid + "c3");
            TableCell c4 = (TableCell)TableTopic.FindControl(trid + "c4");
            TableCell c5 = (TableCell)TableTopic.FindControl(trid + "c5");
            TableCell c6 = (TableCell)TableTopic.FindControl(trid + "c6");

            Button addE = new Button();

            addE.Text     = "SAVE";
            addE.CssClass = "button";
            //addE.Click += addE_Click;
            addE.OnClientClick = "return EditFunction();";

            addE.ID = "addE_" + trid;

            //LblResult.Text = "C2Text : " + TableTopic.FindControl(trid).ID;

            string c2Text, c3Text, c4Text, c5Text;

            c2Text = c2.Text;
            c3Text = c3.Text;
            c4Text = c4.Text;
            c5Text = c5.Text;

            c2.Text = "";
            c3.Text = "";
            c4.Text = "";
            c5.Text = "";
            c6.Controls.RemoveAt(0);
            c6.Controls.RemoveAt(0);

            DropDownList DDLSubTopicName = new DropDownList();
            TextBox      TextBoxHeading1 = new TextBox();
            TextBox      TextBoxHeading2 = new TextBox();
            TextBox      TextBoxDisplay  = new TextBox();

            FillDDl(DDLSubTopicName);
            DDLSubTopicName.Items.FindByText(c2Text).Selected = true;


            TextBoxHeading1.CssClass = "txtBox";
            TextBoxHeading2.CssClass = "txtBox";
            TextBoxDisplay.CssClass  = "txtBox";

            DDLSubTopicName.Text = c2Text;
            TextBoxHeading1.Text = c3Text;
            TextBoxHeading2.Text = c4Text;

            if (c5Text == "Hidden")
            {
                TextBoxDisplay.Text = "0";
            }
            else
            {
                TextBoxDisplay.Text = "1";
            }

            c6.Controls.Add(addE);


            DDLSubTopicName.ID = "DDLSubTopicNameE";
            TextBoxHeading1.ID = "TextBoxHeading1E";
            TextBoxHeading2.ID = "TextBoxHeading2E";
            TextBoxDisplay.ID  = "TextBoxDisplayE";

            DDLSubTopicName.EnableViewState = true;
            TextBoxHeading1.EnableViewState = true;
            TextBoxHeading2.EnableViewState = true;
            TextBoxDisplay.EnableViewState  = true;

            c2.Controls.Add(DDLSubTopicName);
            c3.Controls.Add(TextBoxHeading1);
            c4.Controls.Add(TextBoxHeading2);
            c5.Controls.Add(TextBoxDisplay);
        }
示例#4
0
        protected void Edit_Click(object sender, EventArgs e)
        {
            DataTable DtTopic = BusinessLogic.GetTopicsFromTableTopics();
            Button    btn     = (Button)sender;
            string    id      = btn.ID;
            int       x       = id.LastIndexOf("_");
            string    trid    = id.Substring(x + 1);

            SubTopicID.Value = trid;
            //LblResult.Text += " : trid " + trid;

            //TopicID.Value = trid;

            TableRow  tr = (TableRow)TableTopic.FindControl(trid);
            TableCell c1 = (TableCell)TableTopic.FindControl(trid + "c1");
            TableCell c2 = (TableCell)TableTopic.FindControl(trid + "c2");
            TableCell c3 = (TableCell)TableTopic.FindControl(trid + "c3");
            TableCell c4 = (TableCell)TableTopic.FindControl(trid + "c4");
            TableCell c5 = (TableCell)TableTopic.FindControl(trid + "c5");
            TableCell c6 = (TableCell)TableTopic.FindControl(trid + "c6");

            Image img = (Image)TableTopic.FindControl("Img_" + trid);


            //if (img == null)
            //    LblResult.Text += "Image: No";
            //else
            //    LblResult.Text += "Image: Yes";


            Button addE = new Button();

            addE.ID            = "addE_" + trid;
            addE.Text          = "SAVE";
            addE.CssClass      = "button";
            addE.Click        += addE_Click;
            addE.OnClientClick = "return EditFunction();";


            ////LblResult.Text = "C2Text : " + TableTopic.FindControl(trid).ID;

            string c2Text, c3Text, c4Text, c5Text;

            c2Text = c2.Text;
            c3Text = c3.Text;
            //c4Text = c4.Text;
            c5Text = c5.Text;

            //LblResult.Text += " c2.Text: " + c2Text + " c3.Text: " + c3Text + " c5.Text: " + c5Text;


            c2.Text = "";
            c3.Text = "";
            //c4.Text = "";
            c5.Text = "";
            c6.Controls.RemoveAt(0);
            c6.Controls.RemoveAt(0);

            DropDownList TopicName       = new DropDownList();
            FileUpload   TopicImg        = new FileUpload();
            TextBox      TextBoxSubTopic = new TextBox();
            TextBox      TextBoxDisplay  = new TextBox();

            TextBoxSubTopic.CssClass = "txtBox";
            TextBoxDisplay.CssClass  = "txtBox";
            TopicImg.CssClass        = "txtBox";

            FillDDl(TopicName);
            TopicImg.Attributes.Add("value", img.ImageUrl.Substring(img.ImageUrl.LastIndexOf('/') + 1));

            TopicName.Items.FindByText(c2Text).Selected = true;
            TopicName.EnableViewState = true;

            TextBoxSubTopic.Text = c3Text;
            TextBoxDisplay.Text  = c5Text;

            if (c5Text == "Hidden")
            {
                TextBoxDisplay.Text = "0";
            }
            else
            {
                TextBoxDisplay.Text = "1";
            }

            TopicName.ID       = "DDLTopicIDE";
            TopicImg.ID        = "TextBoxSubTopicImgE";
            TextBoxSubTopic.ID = "TextBoxSubTopicHeadingE";
            TextBoxDisplay.ID  = "TextBoxDisplayE";

            TopicImg.Width = 200;


            c2.Controls.Add(TopicName);
            c3.Controls.Add(TextBoxSubTopic);
            c4.Controls.AddAt(1, TopicImg);
            c5.Controls.Add(TextBoxDisplay);
            c6.Controls.Add(addE);
        }
示例#5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack && Event.Value == "edit")
            {
                addE_Click(sender, e);
            }

            if (!IsPostBack)
            {
                FillDDl(DDLTopicID);
            }

            DataTable dt      = BusinessLogic.GetTableSubTopics();
            DataTable DtTopic = BusinessLogic.GetTopicsFromTableTopics();

            if (dt.Rows.Count > 0)
            {
                for (int i = dt.Rows.Count - 1; i >= 0; i--)
                {
                    int    SubTopicID      = Convert.ToInt32(dt.Rows[i]["SubTopicID"]);
                    int    TopicID         = Convert.ToInt32(dt.Rows[i]["TopicID"]);
                    int    Display         = Convert.ToInt32(dt.Rows[i]["display"]);
                    string SubTopicHeading = dt.Rows[i]["SubTopicHeading"].ToString();
                    string SubTopicImg     = dt.Rows[i]["SubTopicImg"].ToString();
                    Button Edit            = new Button();
                    Button Del             = new Button();

                    TableRow  tr = new TableRow();
                    TableCell c1 = new TableCell();
                    TableCell c2 = new TableCell();
                    TableCell c3 = new TableCell();
                    TableCell c4 = new TableCell();
                    TableCell c5 = new TableCell();
                    TableCell c6 = new TableCell();

                    tr.ID = SubTopicID.ToString();
                    c1.ID = tr.ID + "c1";
                    c2.ID = tr.ID + "c2";
                    c3.ID = tr.ID + "c3";
                    c4.ID = tr.ID + "c4";
                    c5.ID = tr.ID + "c5";
                    c6.ID = tr.ID + "c6";

                    //LblResult.Text += " : " + tr.ID;

                    Edit.Text = "Edit";
                    Del.Text  = "Delete";

                    Edit.ID       = "Edit_" + SubTopicID.ToString();
                    Del.ID        = "Del_" + SubTopicID.ToString();
                    Edit.CssClass = Del.CssClass = "button";

                    Del.Click  += Del_Click;
                    Edit.Click += Edit_Click;

                    c1.CssClass = "TableCell";
                    c2.CssClass = "TableCell";
                    c3.CssClass = "TableCell";
                    c4.CssClass = "TableCell";
                    c5.CssClass = "TableCell";
                    c6.CssClass = "TableCell";

                    c1.Text = SubTopicID.ToString();

                    for (int j = 0; j < DtTopic.Rows.Count; j++)
                    {
                        if ((Convert.ToInt32(TopicID)) == (Convert.ToInt32(DtTopic.Rows[j]["TopicID"])))
                        {
                            c2.Text = DtTopic.Rows[j]["Topic"].ToString();
                        }
                    }

                    c3.Text = SubTopicHeading;

                    Image img = new Image();
                    img.ID       = "Img_" + tr.ID;
                    img.ImageUrl = SubTopicImg;
                    img.Width    = 120;
                    img.Height   = 120;
                    c4.Controls.Add(img);

                    if (Display == 0)
                    {
                        c5.Text = "Hidden";
                    }
                    else
                    {
                        c5.Text = "Visible";
                    }

                    c6.Controls.Add(Edit);
                    c6.Controls.Add(Del);

                    tr.Controls.Add(c1);
                    tr.Controls.Add(c2);
                    tr.Controls.Add(c3);
                    tr.Controls.Add(c4);
                    tr.Controls.Add(c5);
                    tr.Controls.Add(c6);

                    TableTopic.Controls.Add(tr);

                    Control cont = TableTopic.FindControl(tr.ID);

                    //if (cont == null)
                    //{
                    //    LblResult.Text += " tr " + tr.ID + " :: Not ";
                    //}
                    //else
                    //{
                    //    LblResult.Text += " tr " + tr.ID + " :: Yes ";
                    //}
                }
            }
        }
示例#6
0
        protected void Edit_Click(object sender, EventArgs e)
        {
            Button btn  = (Button)sender;
            string id   = btn.ID;
            int    x    = id.LastIndexOf("_");
            string trid = id.Substring(x + 1);

            //LblResult.Text += " : trid " + trid;
            QuesID.Value = trid;

            TableRow  tr = (TableRow)TableTopic.FindControl(trid);
            TableCell c1 = (TableCell)TableTopic.FindControl(trid + "c1");
            TableCell c2 = (TableCell)TableTopic.FindControl(trid + "c2");
            TableCell c3 = (TableCell)TableTopic.FindControl(trid + "c3");
            TableCell c4 = (TableCell)TableTopic.FindControl(trid + "c4");
            TableCell c5 = (TableCell)TableTopic.FindControl(trid + "c5");
            TableCell c6 = (TableCell)TableTopic.FindControl(trid + "c6");
            TableCell c7 = (TableCell)TableTopic.FindControl(trid + "c7");
            TableCell c8 = (TableCell)TableTopic.FindControl(trid + "c8");
            TableCell c9 = (TableCell)TableTopic.FindControl(trid + "c9");

            Button addE = new Button();

            addE.Text     = "SAVE";
            addE.CssClass = "button";
            //addE.Click += addE_Click;
            addE.OnClientClick = "return EditFunction();";

            addE.ID = "addE_" + trid;

            //LblResult.Text = "C2Text : " + TableTopic.FindControl(trid).ID;

            string c2Text, c3Text, c4Text, c5Text, c6Text, c7Text, c8Text;

            c2Text = c2.Text;
            c3Text = c3.Text;
            c4Text = c4.Text;
            c5Text = c5.Text;
            c6Text = c6.Text;
            c7Text = c7.Text;
            c8Text = c8.Text;

            c2.Text = "";
            c3.Text = "";
            c4.Text = "";
            c5.Text = "";
            c6.Text = "";
            c7.Text = "";
            c8.Text = "";
            c9.Controls.RemoveAt(0);
            c9.Controls.RemoveAt(0);

            DropDownList DDLChallengeID    = new DropDownList();
            TextBox      TextBoxQues       = new TextBox();
            TextBox      TextBoxAns1       = new TextBox();
            TextBox      TextBoxAns2       = new TextBox();
            TextBox      TextBoxAns3       = new TextBox();
            TextBox      TextBoxAns4       = new TextBox();
            TextBox      TextBoxCorrectAns = new TextBox();

            FillDDl(DDLChallengeID);
            DDLChallengeID.Items.FindByText(c2Text).Selected = true;

            TextBoxQues.CssClass       = "txtBox";
            TextBoxAns1.CssClass       = "txtBox";
            TextBoxAns2.CssClass       = "txtBox";
            TextBoxAns3.CssClass       = "txtBox";
            TextBoxAns4.CssClass       = "txtBox";
            TextBoxCorrectAns.CssClass = "txtBox";

            TextBoxQues.Text       = c3Text;
            TextBoxAns1.Text       = c4Text;
            TextBoxAns2.Text       = c5Text;
            TextBoxAns3.Text       = c6Text;
            TextBoxAns4.Text       = c7Text;
            TextBoxCorrectAns.Text = c8Text;

            DDLChallengeID.ID    = "DDLChallengeIDE";
            TextBoxQues.ID       = "TextBoxQuesE";
            TextBoxAns1.ID       = "TextBoxAns1E";
            TextBoxAns2.ID       = "TextBoxAns2E";
            TextBoxAns3.ID       = "TextBoxAns3E";
            TextBoxAns4.ID       = "TextBoxAns4E";
            TextBoxCorrectAns.ID = "TextBoxCorrectAnsE";

            c2.Controls.Add(DDLChallengeID);
            c3.Controls.Add(TextBoxQues);
            c4.Controls.Add(TextBoxAns1);
            c5.Controls.Add(TextBoxAns2);
            c6.Controls.Add(TextBoxAns3);
            c7.Controls.Add(TextBoxAns4);
            c8.Controls.Add(TextBoxCorrectAns);
            c9.Controls.Add(addE);
        }