Exemplo n.º 1
0
        private void UpdateDisplay()
        {
            // See if we need to display the add lines popup
            if (!IsPostBack)
            {
                // See if we've added lines
                if (!String.IsNullOrEmpty(Request.QueryString["AddLines"]))
                {
                    // See if we display add lines message and popup
                    if (Convert.ToBoolean(Request.QueryString["AddLines"]))
                    {
                        // Display message, we've saved the shipment, add lines
                        DisplayMessage("The ad-hoc shipment was saved.", DiscoveryMessageType.Success);

                        // Display the add lines dialog
                        GetControl <TDCShipmentLinesAdd>("TDCShipmentLinesAdditions", TDCShipmentFormView.Row).DisplayPopup(true);
                    }
                }
                else if (!String.IsNullOrEmpty(Request.QueryString["ExpandLines"]))
                {
                    if (Convert.ToBoolean(Request.QueryString["ExpandLines"]))
                    {
                        // Load the collapsible panel extender
                        CollapsiblePanelExtender linesExtender = TDCShipmentFormView.Row.FindControl("collapsiblePanelShipmentLines") as CollapsiblePanelExtender;
                        // Make sure we've found it
                        Debug.Assert(null != linesExtender);
                        // Expand lines
                        linesExtender.Collapsed = false;
                    }
                }
            }
        }
Exemplo n.º 2
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            tColsCount.Text   = Journal.ParentUserControl.FixedColumnsCount.ToString();
            tRowsCount.Text   = Journal.ParentUserControl.FixedRowsCount.ToString();
            chkHeader.Checked = Journal.ParentUserControl.FixedHeader;
            //hfSort.Value = Journal.DefaultOrder;

            if (IsPostBack)
            {
                PrepareSettings();
            }
            if (!Journal.DetailsRender && Journal.DrawPanelVisible && !ScriptManager.IsInAsyncPostBack)
            {
                var extender = new CollapsiblePanelExtender
                {
                    ID                = "cp_" + ClientID,
                    BehaviorID        = "cpb_" + ClientID,
                    Collapsed         = true,
                    ExpandDirection   = CollapsiblePanelExpandDirection.Vertical,
                    CollapseControlID = legendSC.ClientID,
                    ExpandControlID   = legendSC.ClientID,
                };
                Journal.ParentUserControl.ExtenderAjaxControl.AddExtender(extender, contentSC.ClientID);
            }

            ppc.OkControlID     = ClientID + "_Ok";
            ppc.OnOkScript      = string.Format("ApplyTableSettings('{0}');{1}", HeaderTableClientID, Page.ClientScript.GetPostBackEventReference(Journal, BaseJournalControl.ApplyTableSettings));
            ppc.CancelControlID = ClientID + "_Cancel";

            ppcFixedHeader.OkControlID = ClientID + "_FHOk";
            ppcFixedHeader.OnOkScript  =
                string.Format(
                    "CreateFixedHeader($get('{0}'), $get('{1}').checked, $get('{2}').value, $get('{3}').value);",
                    Journal.ClientID, chkHeader.ClientID, tRowsCount.ClientID, tColsCount.ClientID);
            //------------------------------
            ccc.OkControlID     = ClientID + "_CCCOk";
            ccc.OnOkScript      = string.Format("createConcatenateColumns({0}); {1}", ConcatenateColumnDivClientID, Page.ClientScript.GetPostBackEventReference(Journal, BaseJournalControl.CreateConcatenateColumns));
            ccc.CancelControlID = ClientID + "_CCCCancel";

            panelColorSample.ToolTip = Resources.SCurrentColor;
            imgColorPicker.ToolTip   = Resources.SColorPalette;
            imgColorPicker.ImageUrl  = Themes.IconUrlColorPickerButton;
        }
 private void AddGroupItems(int groupIndex, string[] groupValues)
 {
     _lastGroupValues = groupValues;
     for (int i = groupIndex; i < GroupFields.Count; i++)
     {
         var groupField = GroupFields[i];
         var group      = new ListControlItem
         {
             Children   = new List <ListControlItem>(),
             IsGroup    = true,
             Selectable = groupField.Selectable,
             Text       = string.IsNullOrEmpty(groupValues[i]) ? groupField.NullText : groupValues[i],
             Value      = "msc_" + Guid.NewGuid().ToString("N"),
         };
         group.HideGroup = string.IsNullOrEmpty(group.Text) && groupField.HideGroupIfValueNull;
         if (groupField.Collapsible && !group.HideGroup && Page != null)
         {
             var clientID = group.Value;
             var extender = new CollapsiblePanelExtender
             {
                 ID                = "cp_" + clientID,
                 BehaviorID        = "cpb_" + clientID,
                 Collapsed         = groupField.DefaultCollapced,
                 ExpandDirection   = CollapsiblePanelExpandDirection.Vertical,
                 CollapseControlID = clientID + "_Legend",
                 ExpandControlID   = clientID + "_Legend",
             };
             ExtenderAjaxControl.AddExtender(extender, clientID);
         }
         if (i == 0)
         {
             Items.Add(group);
         }
         else
         {
             _lastGroups[i - 1].Children.Add(group);
         }
         _lastGroups[i] = group;
     }
 }
Exemplo n.º 4
0
    /// <summary>
    /// Prepares the layout of the web part.
    /// </summary>
    protected override void PrepareLayout()
    {
        StartLayout();

        Append("<div");

        // Width
        string width = this.Width;

        if (!string.IsNullOrEmpty(width))
        {
            Append(" style=\"width: ", width, "\"");
        }

        if (IsDesign)
        {
            Append(" id=\"", ShortClientID, "_env\">");

            Append("<table class=\"LayoutTable\" cellspacing=\"0\" style=\"width: 100%;\">");

            if (this.ViewMode == ViewModeEnum.Design)
            {
                Append("<tr><td class=\"LayoutHeader\" colspan=\"2\">");

                // Add header container
                AddHeaderContainer();

                Append("</td></tr>");
            }

            Append("<tr><td style=\"width: 100%;\">");
        }
        else
        {
            Append(">");
        }

        // Header panel
        Panel pnlHeader = new Panel();

        pnlHeader.ID              = "pnlH";
        pnlHeader.CssClass        = this.HeaderCSSClass;
        pnlHeader.EnableViewState = false;

        // Header label
        Label lblHeader = new Label();

        lblHeader.CssClass = this.HeaderCSSClass;
        lblHeader.ID       = "lblH";

        pnlHeader.Controls.Add(lblHeader);

        // Header image
        Image imgHeader = new Image();

        imgHeader.CssClass = this.ImageCSSClass;
        imgHeader.ID       = "imgH";

        pnlHeader.Controls.Add(imgHeader);


        AddControl(pnlHeader);

        // Content panel
        Panel pnlContent = new Panel();

        pnlContent.CssClass = this.ContentCSSClass;
        pnlContent.ID       = "pnlC";

        AddControl(pnlContent);

        // Add the zone
        CMSWebPartZone zone = AddZone(this.ID + "_zone", this.ID, pnlContent);

        // Add the extender
        CollapsiblePanelExtender cp = new CollapsiblePanelExtender();

        cp.ID = "extCP";
        cp.TargetControlID = pnlContent.ID;

        cp.ExpandControlID   = pnlHeader.ID;
        cp.CollapseControlID = pnlHeader.ID;

        cp.TextLabelID    = lblHeader.ID;
        cp.ImageControlID = imgHeader.ID;

        cp.ExpandDirection = (this.ExpandDirection.Equals("horz", StringComparison.InvariantCultureIgnoreCase) ? CollapsiblePanelExpandDirection.Horizontal : CollapsiblePanelExpandDirection.Vertical);

        // Texts
        string expText = ResHelper.LocalizeString(ExpandedText);
        string colText = ResHelper.LocalizeString(CollapsedText);

        cp.ExpandedText  = expText;
        cp.CollapsedText = colText;

        if (String.IsNullOrEmpty(expText) && String.IsNullOrEmpty(colText))
        {
            lblHeader.Visible = false;
        }

        // Images
        string expImage = this.ExpandedImage;
        string colImage = this.CollapsedImage;

        if (!String.IsNullOrEmpty(expImage) && !String.IsNullOrEmpty(colImage))
        {
            cp.ExpandedImage  = expImage;
            cp.CollapsedImage = colImage;
        }
        else
        {
            imgHeader.Visible = false;
        }

        // Sizes
        int expSize = this.ExpandedSize;

        if (expSize > 0)
        {
            cp.ExpandedSize = expSize;
        }

        int collapsed = this.CollapsedSize;

        if (collapsed >= 0)
        {
            cp.CollapsedSize = this.CollapsedSize;
        }

        cp.Collapsed = this.Collapsed;

        if (!IsDesign)
        {
            cp.AutoCollapse = this.AutoCollapse;
            if (this.AutoExpand)
            {
                cp.AutoExpand = true;

                // Ensure some collapsed size
                if (collapsed < 0)
                {
                    cp.CollapsedSize = 10;
                }
            }
        }

        cp.ScrollContents = this.ScrollContent;

        // Add the extender
        this.Controls.Add(cp);

        if (IsDesign)
        {
            Append("</td>");

            // Width resizer
            if (AllowDesignMode)
            {
                Append("<td class=\"HorizontalResizer\" onmousedown=\"", GetHorizontalResizerScript("env", "Width"), " return false;\">&nbsp;</td>");
            }

            Append("</tr></table>");
        }

        Append("</div>");

        FinishLayout();
    }
    protected void BindContactTemplates(DataTable dt_contacts)
    {
        div_contacts.Controls.Clear();
        bool binding = dt_contacts != null;

        int num_templates = 0;

        if (Int32.TryParse(hf_num_contacts.Value, out num_templates))
        {
            String    qry = "SELECT type_id, CONCAT(contact_type, ' (', system_name, ')') AS contact_type FROM db_contacttype";
            DataTable dt_contact_types = SQL.SelectDataTable(qry, null, null);

            // If binding contacts, use number of contacts plus any manually added templates
            if (binding)
            {
                num_templates = (num_templates - 1) + dt_contacts.Rows.Count;
            }

            if (num_templates == 0)
            {
                lb_new_ctc.Text = "Add a contact";
            }
            else
            {
                lb_new_ctc.Text = "Add another contact";
            }

            for (int t = 0; t < num_templates; t++)
            {
                // Use contact ID as control identifier when binding, if not binding use incremental ints
                String ctc_id = "new_" + (t + 1).ToString();
                if (binding && t < dt_contacts.Rows.Count)
                {
                    ctc_id = "bound_" + dt_contacts.Rows[t]["ctc_id"].ToString();
                }

                // Build table for each contact
                HtmlTable tbl = new HtmlTable()
                {
                    ID = "tbl_ctc_template_" + ctc_id, Border = 0, Width = "100%"
                };

                // Contact number and Delete Button
                HtmlTableRow  tr1   = new HtmlTableRow();
                HtmlTableCell tr1c1 = new HtmlTableCell()
                {
                    ColSpan = 4
                };
                ImageButton delete = new ImageButton();
                delete.ImageUrl      = "~/Images/Icons/minus.png";
                delete.ToolTip       = "Delete this contact";
                delete.Height        = 12;
                delete.Width         = 12;
                delete.ID            = "del_" + ctc_id;
                delete.Click        += new ImageClickEventHandler(DeleteContact);
                delete.OnClientClick = "return confirm('This will delete this contact.\\n\\nAre you sure?');";
                delete.Attributes.Add("style", "position:relative; top:2px; left:5px;");
                tr1.Cells.Add(tr1c1);
                tr1c1.Controls.Add(new Label()
                {
                    ID = "lbl_ctc_no_" + ctc_id, Text = "Contact #" + (t + 1), ForeColor = Color.Gray
                });
                tr1c1.Controls.Add(delete);

                // First and Last Name
                TextBox first_name = new TextBox()
                {
                    ID = "tb_first_name_" + ctc_id, CssClass = "CtcFieldInput"
                };
                TextBox last_name = new TextBox()
                {
                    ID = "tb_last_name_" + ctc_id, CssClass = "CtcFieldInput"
                };

                HtmlTableRow  tr2   = new HtmlTableRow();
                HtmlTableCell tr2c1 = new HtmlTableCell()
                {
                    Width = "25%"
                };
                tr2c1.Controls.Add(new Label()
                {
                    Text = "First Name:", CssClass = "FieldLabel"
                });
                HtmlTableCell tr2c2 = new HtmlTableCell()
                {
                    Width = "25%"
                };
                HtmlTableCell tr2c3 = new HtmlTableCell()
                {
                    Width = "25%"
                };
                tr2c3.Controls.Add(new Label()
                {
                    Text = "Last Name:", CssClass = "FieldLabel"
                });
                HtmlTableCell tr2c4 = new HtmlTableCell()
                {
                    Width = "25%"
                };
                tr2.Cells.Add(tr2c1);
                tr2.Cells.Add(tr2c2);
                tr2.Cells.Add(tr2c3);
                tr2.Cells.Add(tr2c4);
                tr2c2.Controls.Add(first_name);
                tr2c4.Controls.Add(last_name);

                // Title and Job Title
                TextBox title = new TextBox()
                {
                    ID = "tb_title_" + ctc_id, CssClass = "CtcFieldInput"
                };
                TextBox job_title = new TextBox()
                {
                    ID = "tb_job_title_" + ctc_id, CssClass = "CtcFieldInput"
                };

                HtmlTableRow  tr3   = new HtmlTableRow();
                HtmlTableCell tr3c1 = new HtmlTableCell();
                tr3c1.Controls.Add(new Label()
                {
                    Text = "Title (Mr, Mrs):", CssClass = "FieldLabel"
                });
                HtmlTableCell tr3c2 = new HtmlTableCell();
                HtmlTableCell tr3c3 = new HtmlTableCell();
                tr3c3.Controls.Add(new Label()
                {
                    Text = "Job Title:", CssClass = "FieldLabel"
                });
                HtmlTableCell tr3c4 = new HtmlTableCell();
                tr3.Cells.Add(tr3c1);
                tr3.Cells.Add(tr3c2);
                tr3.Cells.Add(tr3c3);
                tr3.Cells.Add(tr3c4);
                tr3c2.Controls.Add(title);
                tr3c4.Controls.Add(job_title);

                // Telephone and Mobile
                TextBox telephone = new TextBox()
                {
                    ID = "tb_telephone_" + ctc_id, CssClass = "CtcFieldInput"
                };
                TextBox mobile = new TextBox()
                {
                    ID = "tb_mobile_" + ctc_id, CssClass = "CtcFieldInput"
                };

                HtmlTableRow  tr4   = new HtmlTableRow();
                HtmlTableCell tr4c1 = new HtmlTableCell();
                tr4c1.Controls.Add(new Label()
                {
                    Text = "Telephone:", CssClass = "FieldLabel"
                });
                HtmlTableCell tr4c2 = new HtmlTableCell();
                HtmlTableCell tr4c3 = new HtmlTableCell();
                tr4c3.Controls.Add(new Label()
                {
                    Text = "Mobile:", CssClass = "FieldLabel"
                });
                HtmlTableCell tr4c4 = new HtmlTableCell();
                tr4.Cells.Add(tr4c1);
                tr4.Cells.Add(tr4c2);
                tr4.Cells.Add(tr4c3);
                tr4.Cells.Add(tr4c4);
                tr4c2.Controls.Add(telephone);
                tr4c4.Controls.Add(mobile);

                // E-mail and E-mail validator
                TextBox email = new TextBox()
                {
                    ID = "tb_email_" + ctc_id, CssClass = "CtcFieldInput"
                };
                RegularExpressionValidator rev_email = new RegularExpressionValidator();
                rev_email.ValidationExpression = Util.regex_email;
                rev_email.ControlToValidate    = "tb_email_" + ctc_id;
                rev_email.ErrorMessage         = "<br/>Invalid e-mail format!";
                rev_email.Display   = ValidatorDisplay.Dynamic;
                rev_email.ForeColor = Color.Red;

                HtmlTableRow  tr5   = new HtmlTableRow();
                HtmlTableCell tr5c1 = new HtmlTableCell();
                tr5c1.Controls.Add(new Label()
                {
                    Text = "E-mail:", CssClass = "FieldLabel"
                });
                HtmlTableCell tr5c2 = new HtmlTableCell()
                {
                    ColSpan = 3
                };
                tr5.Cells.Add(tr5c1);
                tr5.Cells.Add(tr5c2);
                tr5c2.Controls.Add(email);
                tr5c2.Controls.Add(rev_email);

                // Contact Types
                CheckBoxList type = new CheckBoxList()
                {
                    ID = "cbl_type_" + ctc_id
                };
                type.RepeatDirection = System.Web.UI.WebControls.RepeatDirection.Vertical;
                type.DataSource      = dt_contact_types;
                type.DataTextField   = "contact_type";
                type.DataValueField  = "type_id";
                type.DataBind();

                // Type container
                Panel p_title = new Panel()
                {
                    ID = "p_title_type_" + ctc_id
                };
                Label lbl_title = new Label()
                {
                    ID = "lbl_title_type_" + ctc_id
                };
                p_title.Controls.Add(lbl_title);
                lbl_title.CssClass = "ExpandLabel";
                Panel p_body = new Panel()
                {
                    ID = "p_body_type_" + ctc_id
                };
                p_body.Controls.Add(type);

                CollapsiblePanelExtender cpe = new CollapsiblePanelExtender();
                cpe.ID = "cpe_type_" + ctc_id;
                cpe.TargetControlID   = "p_body_type_" + ctc_id;
                cpe.CollapseControlID = "p_title_type_" + ctc_id;
                cpe.ExpandControlID   = "p_title_type_" + ctc_id;
                cpe.TextLabelID       = "lbl_title_type_" + ctc_id;
                cpe.Collapsed         = true;
                cpe.CollapsedText     = "Show Contact Types";
                cpe.ExpandedText      = "Hide Contact Types";
                cpe.CollapsedSize     = 0;
                cpe.AutoCollapse      = false;
                cpe.AutoExpand        = false;
                cpe.ExpandDirection   = CollapsiblePanelExpandDirection.Vertical;
                cpe.ScrollContents    = false;

                HtmlTableRow  tr6   = new HtmlTableRow();
                HtmlTableCell tr6c1 = new HtmlTableCell()
                {
                    VAlign = "top"
                };
                tr6c1.Controls.Add(new Label()
                {
                    Text = "Types:", CssClass = "FieldLabel"
                });
                HtmlTableCell tr6c2 = new HtmlTableCell()
                {
                    ColSpan = 3
                };
                tr6.Cells.Add(tr6c1);
                tr6.Cells.Add(tr6c2);
                tr6c2.Controls.Add(cpe);
                tr6c2.Controls.Add(p_title);
                tr6c2.Controls.Add(p_body);

                // Add rows to contact table
                tbl.Rows.Add(tr1);
                tbl.Rows.Add(tr2);
                tbl.Rows.Add(tr3);
                tbl.Rows.Add(tr4);
                tbl.Rows.Add(tr5);
                tbl.Rows.Add(tr6);

                // Bind contact information if in binding mode
                if (binding && t < dt_contacts.Rows.Count) // ignore any empty templates being added by user
                {
                    first_name.Text = dt_contacts.Rows[t]["first_name"].ToString();
                    last_name.Text  = dt_contacts.Rows[t]["last_name"].ToString();
                    title.Text      = dt_contacts.Rows[t]["title"].ToString();
                    job_title.Text  = dt_contacts.Rows[t]["job_title"].ToString();
                    telephone.Text  = dt_contacts.Rows[t]["phone"].ToString();
                    mobile.Text     = dt_contacts.Rows[t]["mobile"].ToString();
                    email.Text      = dt_contacts.Rows[t]["email"].ToString();

                    // Bind type participation
                    String    tqry         = "SELECT type_id FROM db_contactintype WHERE ctc_id=@ctc_id";
                    DataTable dt_cca_types = SQL.SelectDataTable(tqry, "@ctc_id", dt_contacts.Rows[t]["ctc_id"].ToString());

                    foreach (ListItem cb in type.Items)
                    {
                        cb.Selected = false;
                        for (int i = 0; i < dt_cca_types.Rows.Count; i++)
                        {
                            if (cb.Value == dt_cca_types.Rows[i]["type_id"].ToString())
                            {
                                cb.Selected = true;
                                dt_cca_types.Rows.RemoveAt(i);
                                i--;
                            }
                        }
                    }
                }

                // Add table
                div_contacts.Controls.Add(tbl);
            }
        }
    }
    protected void GenerateTacPreviews(DataTable dt_tac_data)
    {
        // For each TAC entry
        for (int i = 0; i < dt_tac_data.Rows.Count; i++)
        {
            HtmlTable t        = new HtmlTable();
            Panel     p_expand = new Panel();
            p_expand.ID          = "p_ex_" + DateTime.Now.Ticks + "_" + i;
            p_expand.BorderColor = Color.Red;
            p_expand.BorderWidth = 1;
            p_expand.BackColor   = Color.LightGray;
            p_expand.Width       = 730;
            p_expand.Controls.Add(t);
            Panel p_collapse = new Panel();
            p_collapse.ID = "p_co_" + DateTime.Now.Ticks + "_" + i;
            Label lbl_toggle = new Label();
            lbl_toggle.BackColor = Color.MintCream;
            lbl_toggle.ForeColor = Color.Gray;
            lbl_toggle.Height    = 25;
            lbl_toggle.Width     = 400;
            lbl_toggle.Font.Bold = true;
            Util.AddHoverAndClickStylingAttributes(lbl_toggle, true);
            lbl_toggle.ID = "lbl_co" + DateTime.Now.Ticks + "_" + i;
            lbl_toggle.Attributes.Add("onclick", "var w=GetRadWindow(); if(w.get_height() == 200){w.set_height(800);}else{w.set_height(200);} w.center();");
            p_collapse.Controls.Add(lbl_toggle);
            Label lbl_date = new Label();
            lbl_date.Text      = "&nbsp;Created " + Server.HtmlEncode(dt_tac_data.Rows[i]["DateCreated"].ToString().Substring(0, 10));
            lbl_date.ForeColor = Color.DarkOrange;
            lbl_date.Attributes.Add("style", "position:relative; top:8px;");
            p_collapse.Controls.Add(lbl_date);
            div_previews.Controls.Add(p_collapse);
            div_previews.Controls.Add(p_expand);

            // Tac Code Label
            t.Rows.Add(MakeRow("<b>Agreement Number:</b> " + Server.HtmlEncode(dt_tac_data.Rows[i]["AgreementNumber"].ToString())));
            // Company Name label
            t.Rows.Add(MakeRow("<b>Company Name:</b> " + Server.HtmlEncode(dt_tac_data.Rows[i]["CompanyName"].ToString())));
            // sale_person Label
            t.Rows.Add(MakeRow("<b>Sale Person:</b> " + Server.HtmlEncode(dt_tac_data.Rows[i]["sale_person"].ToString())));
            // sale_email Label
            t.Rows.Add(MakeRow("<b>Sale E-mail:</b> " + Server.HtmlEncode(dt_tac_data.Rows[i]["sale_email"].ToString())));
            // sale_contact_no Label
            t.Rows.Add(MakeRow("<b>Sale Contact No.:</b> " + Server.HtmlEncode(dt_tac_data.Rows[i]["sale_contact_no"].ToString())));
            // sale_address Label
            t.Rows.Add(MakeRow("<b>Sale Address:</b> " + Server.HtmlEncode(dt_tac_data.Rows[i]["sale_address"].ToString())));
            // sale_phno Label
            t.Rows.Add(MakeRow("<b>Sale Phone:</b> " + Server.HtmlEncode(dt_tac_data.Rows[i]["sale_phno"].ToString())));
            // DateCreated Label
            t.Rows.Add(MakeRow("<b>Date Created:</b> " + Server.HtmlEncode(dt_tac_data.Rows[i]["DateCreated"].ToString())));
            // DateModified Label
            t.Rows.Add(MakeRow("<b>Date Modified:</b> " + Server.HtmlEncode(dt_tac_data.Rows[i]["DateModified"].ToString())));
            // StatusList Label
            t.Rows.Add(MakeRow("<b>Status:</b> " + Server.HtmlEncode(dt_tac_data.Rows[i]["StatusList"].ToString())));
            // signedby Label
            t.Rows.Add(MakeRow("<b>Signed By:</b> " + Server.HtmlEncode(dt_tac_data.Rows[i]["signedby"].ToString())));
            // Conditions Label
            t.Rows.Add(MakeRow("<br/><b>Conditions:</b>"));

            // Conditions Textboxes
            HtmlTableRow  r = new HtmlTableRow();
            HtmlTableCell c = new HtmlTableCell();
            c.BgColor = "White";
            t.Rows.Add(r);
            r.Cells.Add(c);
            TextBox tb_preview = new TextBox();
            tb_preview.EnableViewState = true;
            tb_preview.TextMode        = TextBoxMode.MultiLine;
            tb_preview.ID     = "tb_c_prev_" + DateTime.Now.Ticks + "_" + i;
            tb_preview.Height = 500;
            tb_preview.Width  = 700;
            tb_preview.Text   = dt_tac_data.Rows[i]["tn_condition"].ToString();
            HtmlEditorExtender html_e = new HtmlEditorExtender();
            html_e.ID = "html_c_e" + DateTime.Now.Ticks + "_" + i;
            html_e.TargetControlID  = tb_preview.ID;
            html_e.DisplaySourceTab = true;
            c.Controls.Add(tb_preview);
            c.Controls.Add(html_e);

            // break
            t.Rows.Add(MakeRow("<br/>"));

            // Payment Label
            t.Rows.Add(MakeRow("<b>Payment Information:</b>"));
            // Payment Textboxes
            r         = new HtmlTableRow();
            c         = new HtmlTableCell();
            c.BgColor = "White";
            t.Rows.Add(r);
            r.Cells.Add(c);
            tb_preview = new TextBox();
            tb_preview.EnableViewState = true;
            tb_preview.TextMode        = TextBoxMode.MultiLine;
            tb_preview.ID           = "tb_p_prev_" + DateTime.Now.Ticks + "_" + i;
            tb_preview.Height       = 250;
            tb_preview.Width        = 700;
            tb_preview.Text         = dt_tac_data.Rows[i]["PaymentInformation"].ToString();
            html_e                  = new HtmlEditorExtender();
            html_e.ID               = "html_p_e" + DateTime.Now.Ticks + "_" + i;
            html_e.TargetControlID  = tb_preview.ID;
            html_e.DisplaySourceTab = true;
            c.Controls.Add(tb_preview);
            c.Controls.Add(html_e);

            // break
            t.Rows.Add(MakeRow("<br/><br/>"));

            // Generate collapsible panel
            CollapsiblePanelExtender cpe = new CollapsiblePanelExtender();
            cpe.ID                = "cpe_" + DateTime.Now.Ticks + "_" + i;
            cpe.ScrollContents    = true;
            cpe.ExpandDirection   = CollapsiblePanelExpandDirection.Vertical;
            cpe.AutoExpand        = false;
            cpe.AutoCollapse      = false;
            cpe.ExpandedSize      = 750;
            cpe.CollapsedSize     = 0;
            cpe.CollapsedText     = "&nbsp;Click to expand TAC agreement " + dt_tac_data.Rows[i]["AgreementNumber"] + " (" + (i + 1) + " of  " + dt_tac_data.Rows.Count + ")";
            cpe.ExpandedText      = cpe.CollapsedText.Replace(" expand ", " collapse ");
            cpe.Collapsed         = true;
            cpe.TargetControlID   = p_expand.ID;
            cpe.CollapseControlID = p_collapse.ID;
            cpe.ExpandControlID   = p_collapse.ID;
            cpe.TextLabelID       = lbl_toggle.ID;
            p_expand.Controls.Add(cpe);

            // break
            div_previews.Controls.Add(new LiteralControl("<hr/>"));
            div_previews.Controls.Add(new LiteralControl("<br/>"));
        }
    }
Exemplo n.º 7
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            if (DesignMode)
            {
                return;
            }

            Panel panel = new Panel();

            Controls.Add(panel);
            panel.Style["position"] = "relative";

            // Filters' list
            collapseImage    = new Image();
            collapseImage.ID = "collapseImageID";
            panel.Controls.Add(collapseImage);
            collapseImage.Style["position"] = "absolute";
            collapseImage.Style["right"]    = "4px";
            collapseImage.Style["top"]      = "0px";
            collapseImage.Style["cursor"]   = "hand";
            collapseImage.Style["z-index"]  = "1";


            Panel filterContainerPanel = new Panel();

            filterContainerPanel.ID = "filterContaiterPanelID";
            panel.Controls.Add(filterContainerPanel);
            filterContainerPanel.GroupingText = LookupControlsResources.SFilterCriteria;

            columnFilterList    = GetColumnFilterList();
            columnFilterList.ID = "columnFilterListID";
            columnFilterList.ColumnFilterListCreating += ColumnFilterList_OnColumnFilterListCreating;

            columnFilterList.PopupBehaviorParentNode = ClientID;
            filterContainerPanel.Controls.Add(columnFilterList);
            columnFilterList.DataSourceID            = dataSourceID;
            columnFilterList.DataSource              = dataSource;
            columnFilterList.ShowFullBriefViewButton = showFullBriefViewButton;

            CollapsiblePanelExtender collapsiblePanelExtender = new CollapsiblePanelExtender();

            panel.Controls.Add(collapsiblePanelExtender);
            collapsiblePanelExtender.TargetControlID   = filterContainerPanel.ID;
            collapsiblePanelExtender.ExpandControlID   = collapseImage.ID;
            collapsiblePanelExtender.CollapseControlID = collapseImage.ID;
            collapsiblePanelExtender.ImageControlID    = collapseImage.ID;

            collapsiblePanelExtender.CollapsedImage =
                Page.ClientScript.GetWebResourceUrl(GetType(), "Nat.Web.Controls.Lookup.control_fastforward_blue.png");
            collapsiblePanelExtender.ExpandedImage =
                Page.ClientScript.GetWebResourceUrl(GetType(), "Nat.Web.Controls.Lookup.control_rewind_blue.png");

            collapsiblePanelExtender.ExpandedText  = LookupControlsResources.SHideFilter;
            collapsiblePanelExtender.CollapsedText = LookupControlsResources.SShowFilter;
            collapsiblePanelExtender.CollapsedSize = 17;

            // UpdatePanel for GridView
            updatePanel            = new UpdatePanel();
            updatePanel.ID         = "updatePanelID";
            updatePanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
            panel.Controls.Add(updatePanel);

            // HiddenField
            hiddenField    = new HiddenField();
            hiddenField.ID = "hiddenFieldID";
            //panel.Controls.Add(hiddenField);
            updatePanel.ContentTemplateContainer.Controls.Add(hiddenField);
            hiddenField.ValueChanged += HiddenField_OnValueChanged;


            // GridView
            gridContainerPanel    = new Panel();
            gridContainerPanel.ID = "gridContainerPanelID";
            updatePanel.ContentTemplateContainer.Controls.Add(gridContainerPanel);
            gridContainerPanel.Style["clear"] = "both";

            gridPanel    = new Panel();
            gridPanel.ID = "gridPanelID";
            gridContainerPanel.Controls.Add(gridPanel);
            gridPanel.ScrollBars = ScrollBars.Auto;
            gridPanel.Height     = GridHeight;


            gridView                          = new GridViewExt();
            gridView.ID                       = "gridViewID";
            gridView.DataKeyNames             = dataKeyNames;
            gridView.UseDeleteField           = allowMultiSelectColumn;
            gridView.DeleteFieldColumnCaption = multiSelectColumnCaption;

            gridView.DataSourceID = "666";
            gridView.DataSourceID = "";

            gridView.DataSourceID = dataSourceID;
            gridView.DataSource   = dataSource;

            gridPanel.Controls.Add(gridView);
            gridView.EmptyDataText = EmptyDataText;

            gridView.AllowSorting                  = allowSorting;
            gridView.PageIndexChanged             += GridView_OnPageIndexChanged;
            gridView.Sorted                       += GridView_OnSorted;
            gridView.PagerSettings.Mode            = PagerButtons.NumericFirstLast;
            gridView.PagerSettings.PageButtonCount = 5;
            gridView.DataBound                    += GridView_OnDataBound;

            gridViewExtender    = new GridViewExtender();
            gridViewExtender.ID = "gridViewExtenderID";
            gridPanel.Controls.Add(gridViewExtender);
            gridViewExtender.TargetControlID     = gridView.ID;
            gridViewExtender.DataDisableRowField = dataDisableRowField;
            gridViewExtender.ConditionValue      = conditionValue;

            // Hidden apply filter button
            applyButton    = new Button();
            applyButton.ID = "applyButtonID";
            updatePanel.ContentTemplateContainer.Controls.AddAt(0, applyButton);
            applyButton.Click           += ApplyButton_OnClick;
            applyButton.Text             = "Apply Filter";
            applyButton.Style["float"]   = "right";
            applyButton.Style["display"] = "none";
        }
    protected void BindContactTemplates(DataTable dt_contacts)
    {
        div_contacts.Controls.Clear();
        bool binding              = dt_contacts != null;
        int  num_templates        = 0;
        bool is_first_new_contact = true;

        if (Int32.TryParse(hf_num_contacts.Value, out num_templates))
        {
            String    qry = "SELECT type_id, system_name FROM db_contacttype WHERE contact_type=system_name ORDER BY system_name";
            DataTable dt_contact_systems = SQL.SelectDataTable(qry, null, null);
            qry = "SELECT type_id, contact_type, system_name FROM db_contacttype WHERE contact_type!=system_name ORDER BY system_name";
            DataTable dt_contact_types = SQL.SelectDataTable(qry, null, null);

            // If binding contacts, use number of contacts plus any manually added templates
            if (binding)
            {
                num_templates = (num_templates - 1) + dt_contacts.Rows.Count;
            }

            if (num_templates == 0)
            {
                btn_add_another_contact.Text = "Add a contact";
            }

            for (int t = 0; t < num_templates; t++)
            {
                // Use contact ID as control identifier when binding, if not binding use incremental ints
                bool   new_contact = true;
                String ctc_id      = "new_" + (t + 1).ToString();
                if (binding && t < dt_contacts.Rows.Count)
                {
                    ctc_id      = "bound_" + dt_contacts.Rows[t]["ctc_id"].ToString();
                    new_contact = false;
                }

                // Build table for each contact
                HtmlTable tbl = new HtmlTable()
                {
                    ID = "tbl_ctc_template_" + ctc_id, Width = TableWidth.ToString(), Border = TableBorder
                };
                // Add table & ensure it's visible (due to potential deletions)
                UpdatePanel udp = new UpdatePanel();
                udp.ChildrenAsTriggers = true;
                udp.ContentTemplateContainer.Controls.Add(tbl);
                div_contacts.Controls.Add(udp);
                tbl.Visible = true;

                // Contact number and Delete Button
                HtmlTableRow  tr1   = new HtmlTableRow();
                HtmlTableCell tr1c1 = new HtmlTableCell()
                {
                    ColSpan = 4
                };
                ImageButton delete = new ImageButton();
                delete.ImageUrl      = "~/Images/Icons/minus.png";
                delete.ToolTip       = "Delete this contact";
                delete.Height        = 12;
                delete.Width         = 12;
                delete.ID            = "del_" + ctc_id;
                delete.Click        += new ImageClickEventHandler(DeleteContact);
                delete.OnClientClick = "return confirm('This will delete this contact.\\n\\nAre you sure?');";
                delete.Attributes.Add("style", "position:relative; top:2px; left:5px;");
                tr1.Cells.Add(tr1c1);
                tr1c1.Controls.Add(new Label()
                {
                    ID = "lbl_ctc_no_" + ctc_id, Text = "<br/>Contact " + (t + 1)
                });
                tr1c1.Controls.Add(delete);

                // First and Last Name
                TextBox first_name = new TextBox()
                {
                    ID = "tb_first_name_" + ctc_id, Width = new Unit(ContentWidthPercent + "%"), Text = "John"
                };
                TextBox last_name = new TextBox()
                {
                    ID = "tb_last_name_" + ctc_id, Width = new Unit(ContentWidthPercent + "%"), Text = "Smith"
                };

                HtmlTableRow  tr2   = new HtmlTableRow();
                HtmlTableCell tr2c1 = new HtmlTableCell()
                {
                    InnerText = "First Name:", Width = Column1WidthPercent + "%"
                };
                HtmlTableCell tr2c2 = new HtmlTableCell()
                {
                    Width = Column2WidthPercent + "%"
                };
                HtmlTableCell tr2c3 = new HtmlTableCell()
                {
                    InnerText = "Last Name:", Width = Column3WidthPercent + "%"
                };
                HtmlTableCell tr2c4 = new HtmlTableCell()
                {
                    Width = Column4WidthPercent + "%"
                };
                tr2.Cells.Add(tr2c1);
                tr2.Cells.Add(tr2c2);
                tr2.Cells.Add(tr2c3);
                tr2.Cells.Add(tr2c4);
                tr2c2.Controls.Add(first_name);
                tr2c4.Controls.Add(last_name);

                // Job Title
                TextBox job_title = new TextBox()
                {
                    ID = "tb_job_title_" + ctc_id, Width = new Unit("99%"), Text = "Account Manager"
                };

                HtmlTableRow  tr3   = new HtmlTableRow();
                HtmlTableCell tr3c3 = new HtmlTableCell()
                {
                    InnerText = "Job Title:"
                };
                HtmlTableCell tr3c4 = new HtmlTableCell()
                {
                    ColSpan = 3
                };
                tr3.Cells.Add(tr3c3);
                tr3.Cells.Add(tr3c4);
                tr3c4.Controls.Add(job_title);

                // Telephone and Mobile
                TextBox telephone = new TextBox()
                {
                    ID = "tb_telephone_" + ctc_id, Width = new Unit(ContentWidthPercent + "%"), Text = "+447596447472"
                };
                TextBox mobile = new TextBox()
                {
                    ID = "tb_mobile_" + ctc_id, Width = new Unit(ContentWidthPercent + "%"), Text = "+447596447472"
                };

                HtmlTableRow  tr4   = new HtmlTableRow();
                HtmlTableCell tr4c1 = new HtmlTableCell()
                {
                    InnerText = "Telephone:"
                };
                HtmlTableCell tr4c2 = new HtmlTableCell();
                HtmlTableCell tr4c3 = new HtmlTableCell()
                {
                    InnerText = "Mobile:"
                };
                HtmlTableCell tr4c4 = new HtmlTableCell();
                tr4.Cells.Add(tr4c1);
                tr4.Cells.Add(tr4c2);
                tr4.Cells.Add(tr4c3);
                tr4.Cells.Add(tr4c4);
                tr4c2.Controls.Add(telephone);
                tr4c4.Controls.Add(mobile);

                // E-mail and E-mail validator
                TextBox email = new TextBox()
                {
                    ID = "tb_email_" + ctc_id, Width = new Unit("99%"), Text = "*****@*****.**"
                };
                RegularExpressionValidator rev_email = new RegularExpressionValidator();
                rev_email.ValidationExpression = Util.regex_email;
                rev_email.ControlToValidate    = "tb_email_" + ctc_id;
                rev_email.ErrorMessage         = "<br/>Invalid e-mail format!";
                rev_email.Display   = ValidatorDisplay.Dynamic;
                rev_email.ForeColor = Color.Red;

                HtmlTableRow  tr5   = new HtmlTableRow();
                HtmlTableCell tr5c1 = new HtmlTableCell()
                {
                    InnerText = "E-mail:"
                };
                HtmlTableCell tr5c2 = new HtmlTableCell()
                {
                    ColSpan = 3
                };
                tr5.Cells.Add(tr5c1);
                tr5.Cells.Add(tr5c2);
                tr5c2.Controls.Add(email);
                tr5c2.Controls.Add(rev_email);

                // Contact type container
                Panel p_title = new Panel()
                {
                    ID = "p_title_type_" + ctc_id
                };
                Label lbl_title = new Label()
                {
                    ID = "lbl_title_type_" + ctc_id
                };
                lbl_title.Attributes.Add("style", "cursor: pointer; cursor: hand;");
                p_title.Controls.Add(lbl_title);
                Panel p_body = new Panel()
                {
                    ID = "p_body_type_" + ctc_id
                };

                // Bind contact information if in binding mode
                DataTable dt_cca_types = new DataTable();
                if (binding && t < dt_contacts.Rows.Count) // ignore any empty templates being added by user
                {
                    first_name.Text = dt_contacts.Rows[t]["first_name"].ToString();
                    last_name.Text  = dt_contacts.Rows[t]["last_name"].ToString();
                    job_title.Text  = dt_contacts.Rows[t]["job_title"].ToString();
                    telephone.Text  = dt_contacts.Rows[t]["phone"].ToString();
                    mobile.Text     = dt_contacts.Rows[t]["mobile"].ToString();
                    email.Text      = dt_contacts.Rows[t]["email"].ToString();

                    // Bind type participation
                    String tqry = "SELECT type_id FROM db_contactintype WHERE ctc_id=@ctc_id";
                    dt_cca_types = SQL.SelectDataTable(tqry, "@ctc_id", dt_contacts.Rows[t]["ctc_id"].ToString());
                }

                // Build contact types
                for (int i = 0; i < dt_contact_systems.Rows.Count; i++)
                {
                    String      system_name = dt_contact_systems.Rows[i]["system_name"].ToString();
                    String      system_id   = dt_contact_systems.Rows[i]["type_id"].ToString();
                    RadTreeView tree        = new RadTreeView()
                    {
                        ID = "rtv_" + i + ctc_id, CheckBoxes = true, CheckChildNodes = false
                    };
                    RadTreeNode node = new RadTreeNode()
                    {
                        Text = system_name, Value = system_id
                    };
                    tree.Nodes.Add(node);

                    // always check the system type we're adding into, unless contacts are being bound from different system
                    if (system_name == TargetSystem)
                    {
                        node.Expanded = true;
                        if (new_contact)
                        {
                            node.Checked   = true;
                            node.Checkable = false;
                            node.Text     += " (Compulsory)";
                        }
                    }

                    for (int x = 0; x < dt_cca_types.Rows.Count; x++) // check parent system participation
                    {
                        if (system_id == dt_cca_types.Rows[x]["type_id"].ToString())
                        {
                            node.Checked = true;
                            break;
                        }
                    }

                    for (int j = 0; j < dt_contact_types.Rows.Count; j++) // check child type participation
                    {
                        if (dt_contact_types.Rows[j]["system_name"].ToString() == system_name)
                        {
                            String type_name = dt_contact_types.Rows[j]["contact_type"].ToString();
                            String type_id   = dt_contact_types.Rows[j]["type_id"].ToString();

                            bool Checked = false;
                            // Select first child item if we're not binding existing contacts and AutoSelectFirstContactType=true is specified in control declaration
                            // Only apply this rule for the first contact
                            if (AutoSelectFirstContactType && tree.Nodes[0].Nodes.Count == 0 && new_contact && system_name == TargetSystem && is_first_new_contact)
                            {
                                Checked = true;
                                is_first_new_contact = false;
                            }
                            else if (!new_contact) // determine whether to check specific item
                            {
                                for (int x = 0; x < dt_cca_types.Rows.Count; x++)
                                {
                                    if (type_id == dt_cca_types.Rows[x]["type_id"].ToString())
                                    {
                                        Checked = true;
                                        break;
                                    }
                                }
                            }

                            RadTreeNode c_node = new RadTreeNode()
                            {
                                Text = type_name, Value = type_id, Checked = Checked
                            };
                            tree.Nodes[0].Nodes.Add(c_node);
                        }
                    }
                    p_body.Controls.Add(tree);
                }

                CollapsiblePanelExtender cpe = new CollapsiblePanelExtender();
                cpe.ID = "cpe_type_" + ctc_id;
                cpe.TargetControlID   = "p_body_type_" + ctc_id;
                cpe.CollapseControlID = "p_title_type_" + ctc_id;
                cpe.ExpandControlID   = "p_title_type_" + ctc_id;
                cpe.TextLabelID       = "lbl_title_type_" + ctc_id;
                cpe.Collapsed         = true;
                cpe.CollapsedText     = "Show Contact Types";
                cpe.ExpandedText      = "Hide Contact Types";
                cpe.CollapsedSize     = 0;
                cpe.AutoCollapse      = false;
                cpe.AutoExpand        = false;
                cpe.ExpandDirection   = CollapsiblePanelExpandDirection.Vertical;
                cpe.ScrollContents    = false;

                HtmlTableRow  tr6   = new HtmlTableRow();
                HtmlTableCell tr6c1 = new HtmlTableCell()
                {
                    VAlign = "top"
                };
                tr6c1.Controls.Add(new Label()
                {
                    Text = "Types:"
                });
                HtmlTableCell tr6c2 = new HtmlTableCell()
                {
                    ColSpan = 3
                };
                tr6.Cells.Add(tr6c1);
                tr6.Cells.Add(tr6c2);
                tr6c2.Controls.Add(cpe);
                tr6c2.Controls.Add(p_title);
                tr6c2.Controls.Add(p_body);

                DropDownList dd_job_function = new DropDownList();
                dd_job_function.ID = "jf_" + t;
                qry = "SELECT * FROM dbd_jobfunction ORDER BY jobfunction";
                dd_job_function.DataSource     = SQL.SelectDataTable(qry, null, null);
                dd_job_function.DataValueField = "jobfunctionid";
                dd_job_function.DataTextField  = "jobfunction";
                dd_job_function.DataBind();
                dd_job_function.AutoPostBack          = true;
                dd_job_function.SelectedIndexChanged += new EventHandler(dd_job_function_SelectedIndexChanged);
                dd_job_function.Items.Insert(0, new ListItem(String.Empty, String.Empty));

                DropDownList dd_sub_job_function = new DropDownList();
                dd_sub_job_function.ID = "sjf_" + t;

                HtmlTableRow  tr7   = new HtmlTableRow();
                HtmlTableCell tr7c1 = new HtmlTableCell()
                {
                    InnerText = "Job Function:"
                };
                HtmlTableCell tr7c2 = new HtmlTableCell();
                HtmlTableCell tr7c3 = new HtmlTableCell()
                {
                    InnerText = "Sub Job Function:"
                };
                HtmlTableCell tr7c4 = new HtmlTableCell();
                tr7.Cells.Add(tr7c1);
                tr7.Cells.Add(tr7c2);
                tr7.Cells.Add(tr7c3);
                tr7.Cells.Add(tr7c4);
                tr7c2.Controls.Add(dd_job_function);
                tr7c4.Controls.Add(dd_sub_job_function);

                // Add rows to contact table
                tbl.Rows.Add(tr1);
                tbl.Rows.Add(tr2);
                tbl.Rows.Add(tr5);
                tbl.Rows.Add(tr4);
                tbl.Rows.Add(tr3);
                //tbl.Rows.Add(tr6);
                tbl.Rows.Add(tr7);
            }
        }
    }
    private void AddCollapsablePanel(string index, GolferInfo golferNames, Scoring.MatchupResults resultsA, Scoring.MatchupResults resultsB, CourseInfo courseInfo)
    {
        Table scoreCardTable = new Table();

        AddCourseInfoRows(scoreCardTable, courseInfo);
        AddGolferScores(scoreCardTable, golferNames, resultsA, resultsB, courseInfo);

        decimal team1totalPts = 0, team2totalPts = 0;

        team1totalPts = resultsA.totalPtsPlayer1 + resultsB.totalPtsPlayer1;
        team2totalPts = resultsA.totalPtsPlayer2 + resultsB.totalPtsPlayer2;
        string medalPlayWinner = "";

        if ((resultsA.netScorePlayer1 + resultsB.netScorePlayer1) < (resultsA.netScorePlayer2 + resultsB.netScorePlayer2))
        {
            medalPlayWinner = golferNames.Team1Name + "  (" + (resultsA.netScorePlayer1 + resultsB.netScorePlayer1).ToString() + " to " + (resultsA.netScorePlayer2 + resultsB.netScorePlayer2).ToString() + ")";
            team1totalPts  += 2;
        }
        else if ((resultsA.netScorePlayer1 + resultsB.netScorePlayer1) > (resultsA.netScorePlayer2 + resultsB.netScorePlayer2))
        {
            medalPlayWinner = golferNames.Team2Name + "  (" + (resultsA.netScorePlayer2 + resultsB.netScorePlayer2).ToString() + " to " + (resultsA.netScorePlayer1 + resultsB.netScorePlayer1).ToString() + ")";
            team2totalPts  += 2;
        }
        else
        {
            team1totalPts  += 1;
            team2totalPts  += 1;
            medalPlayWinner = "Teams Tied";
        }
        //Add Row for Medal Play
        TableRow row = new TableRow();

        row.BorderStyle = BorderStyle.Solid;
        TableCell mpCell1 = AddCell(row, "Medal Play Winner (2pts): ");
        TableCell mpCell2 = AddCell(row, medalPlayWinner);

        mpCell1.ColumnSpan = 3;
        mpCell2.ColumnSpan = 10;
        mpCell1.Font.Size  = 14;
        mpCell2.Font.Size  = 14;
        mpCell1.Font.Bold  = true;
        //medalPlayCell.BorderStyle = BorderStyle.Solid;
        scoreCardTable.Rows.Add(row);

        TableRow total_pts_row = new TableRow();

        total_pts_row.BorderStyle = BorderStyle.Solid;
        TableCell c1 = AddCell(total_pts_row, "Total Pts: ");

        c1.ColumnSpan      = 1;
        c1.HorizontalAlign = HorizontalAlign.Center;
        c1.Font.Size       = 14;
        c1.Font.Bold       = true;
        TableCell c2 = AddCell(total_pts_row, golferNames.Team1Name + " " + team1totalPts.ToString() + " -----");

        c2.ColumnSpan      = 8;
        c2.HorizontalAlign = HorizontalAlign.Center;
        c2.Font.Size       = 14;
        //c2.BorderStyle = BorderStyle.Solid;

        TableCell c3 = AddCell(total_pts_row, golferNames.Team2Name + " " + team2totalPts.ToString());

        c3.ColumnSpan      = 4;
        c3.HorizontalAlign = HorizontalAlign.Center;
        c3.Font.Size       = 14;
        //c3.BorderStyle = BorderStyle.Solid;
        scoreCardTable.Rows.Add(total_pts_row);

        //Boolean AplayersTied, BplayersTied;
        //string[] titleLabelText = CreateTitleLabelTextForMatchup(golferNames, resultsA, resultsB, out AplayersTied, out BplayersTied);


        // Create Header Panel
        Panel panelHead = new Panel();

        panelHead.ID           = "pH" + index;
        panelHead.BackImageUrl = "~/images/bg-menu-main.png";


        if (resultsA.totalPtsPlayer1 > resultsA.totalPtsPlayer2)
        {
            panelHead.Controls.Add(AddTrophy());
        }
        string text = golferNames.Aplayer1Name + " (" + resultsA.grossScorePlayer1 + ") vs. ";

        panelHead.Controls.Add(CreateTitleLable(text));

        if (resultsA.totalPtsPlayer2 > resultsA.totalPtsPlayer1)
        {
            panelHead.Controls.Add(AddTrophy());
        }
        text = golferNames.Aplayer2Name + " (" + resultsA.grossScorePlayer2 + ") ----- ";
        panelHead.Controls.Add(CreateTitleLable(text));


        if (resultsB.totalPtsPlayer1 > resultsB.totalPtsPlayer2)
        {
            panelHead.Controls.Add(AddTrophy());
        }
        text = golferNames.Bplayer1Name + " (" + resultsB.grossScorePlayer1 + ") vs. ";
        panelHead.Controls.Add(CreateTitleLable(text));

        if (resultsB.totalPtsPlayer2 > resultsB.totalPtsPlayer1)
        {
            panelHead.Controls.Add(AddTrophy());
        }
        text = golferNames.Bplayer2Name + " (" + resultsB.grossScorePlayer2 + ")";
        panelHead.Controls.Add(CreateTitleLable(text));


        // Add Label inside header panel to display text
        //Label lblHead1 = new Label();
        //lblHead1.ForeColor = Color.White;
        //lblHead1.ID = "lblHeader" + index + "_1";
        //lblHead1.Font.Size = 16;
        //lblHead1.Text = titleLabelText[0];

        //Label lblHead2 = new Label();
        //lblHead2.ForeColor = Color.White;
        //lblHead2.Font.Size = 16;
        //lblHead2.ID = "lblHeader" + index + "_2";
        //lblHead2.Text = titleLabelText[1];

        //if (!AplayersTied)//if they didnt tie then the winning player is listed first, insert trophy
        //{
        //    System.Web.UI.WebControls.Image trophy1 = new System.Web.UI.WebControls.Image();
        //    trophy1.ImageUrl = "~/images/trophy4.png";

        //    //trophy1.Height = new Unit(30, UnitType.Pixel);
        //    //trophy1.Width = new Unit(20, UnitType.Pixel);
        //    //trophy1.Width = new Unit(51, UnitType.Pixel);
        //    panelHead.Controls.Add(trophy1);
        //}
        //panelHead.Controls.Add(lblHead1);

        //if (!BplayersTied)//if they didnt tie then the winning player is listed first, insert trophy
        //{
        //    System.Web.UI.WebControls.Image trophy2 = new System.Web.UI.WebControls.Image();
        //    trophy2.ImageUrl = "~/images/trophy4.png";
        //    //trophy2.Height = new Unit(60, UnitType.Pixel);
        //    panelHead.Controls.Add(trophy2);
        //}
        //panelHead.Controls.Add(lblHead2);


        System.Web.UI.WebControls.Image expandButton = new System.Web.UI.WebControls.Image();
        expandButton.ID         = "expandButton" + index;
        expandButton.ImageAlign = ImageAlign.Right;
        panelHead.Controls.Add(expandButton);
        panelHead.HorizontalAlign = HorizontalAlign.Left;


        //Create Body Panel
        Panel panelBody = new Panel();

        panelBody.ID = "pB" + index;

        // Add Label inside body Panel to display text
        //Label lblB = new Label();
        //lblB.ID = "lblBody" + index;
        //lblB.Text = "This panel was added dynamically";
        panelBody.Controls.Add(scoreCardTable);

        // Create CollapsiblePanelExtender
        CollapsiblePanelExtender cpe = new CollapsiblePanelExtender();

        cpe.ID = "cpe_" + index;
        cpe.TargetControlID   = panelBody.ID;
        cpe.ExpandControlID   = panelHead.ID;
        cpe.CollapseControlID = panelHead.ID;
        cpe.ScrollContents    = false;
        cpe.Collapsed         = true;
        cpe.ExpandDirection   = CollapsiblePanelExpandDirection.Vertical;
        cpe.SuppressPostBack  = true;
        //cpe.TextLabelID = lblHead.ID;
        cpe.ExpandedImage  = "~/images/collapse_blue.jpg";
        cpe.CollapsedImage = "~/images/expand_blue.jpg";
        cpe.ImageControlID = expandButton.ID;
        //cpe.CollapsedText = "Click to Show Content..";
        //cpe.ExpandedText = "";

        this.Panel_Matchups.ContentTemplateContainer.Controls.Add(panelHead);
        this.Panel_Matchups.ContentTemplateContainer.Controls.Add(panelBody);
        this.Panel_Matchups.ContentTemplateContainer.Controls.Add(cpe);
        this.Panel_Matchups.ContentTemplateContainer.Controls.Add(new LiteralControl("&nbsp"));
    }