Ejemplo n.º 1
0
        private void DisplayCustomProperties()
        {
            TableGrid table = null;

            if (AssignmentProperties.Properties.Count > 0)
            {
                table = (TableGrid)tgrComments.Parent;
            }

            if (table != null)
            {
                int index = FindCustomPropertyIndex(table);;

                foreach (AssignmentProperty property in AssignmentProperties.Properties)
                {
                    TableGridRow row = new TableGridRow();
                    AddCustomCell(row, TableGridColumn.FormType.FormLabel, "custom_ID_", property.Name, property.Title);

                    if (property.Type == AssignmentPropertyType.Url)
                    {
                        AddCustomUrlCell(row, TableGridColumn.FormType.FormBody, "custom_value_", property.Name, property.Value);
                    }
                    else
                    {
                        AddCustomCell(row, TableGridColumn.FormType.FormBody, "custom_value_", property.Name, property.Value);
                    }

                    table.Rows.AddAt(index, row);
                    index++;
                }
            }
        }
Ejemplo n.º 2
0
        private void AddIframe(string embedUrl, string iframeFormat)
        {
            TableGrid table = null;

            Control parent = lblDescription.Parent;

            while (parent != null)
            {
                table = parent as TableGrid;
                if (table != null)
                {
                    break;
                }
                else
                {
                    parent = parent.Parent;
                }
            }

            if (table != null)
            {
                TableGridRow row = new TableGridRow();

                TableGridColumn column = new TableGridColumn();

                Label label = new Label();
                label.Text = string.Format(CultureInfo.InvariantCulture, iframeFormat, embedUrl);
                column.Controls.Add(label);

                row.Cells.Add(column);

                table.Rows.Add(row);
            }
        }
Ejemplo n.º 3
0
        private void AddCustomCell(TableGridRow row, TableGridColumn.FormType formType, string idPrefix, string propertyName, string text)
        {
            TableGridColumn column = new TableGridColumn();

            column.ColumnType = formType;
            Label label = new Label();

            label.ID   = idPrefix + propertyName;
            label.Text = Server.HtmlEncode(text);
            column.Controls.Add(label);
            row.Cells.Add(column);
        }
Ejemplo n.º 4
0
        private void AddCustomUrlCell(TableGridRow row, TableGridColumn.FormType formType, string idPrefix, string propertyName, string text)
        {
            TableGridColumn column = new TableGridColumn();

            column.ColumnType = formType;
            if (string.IsNullOrEmpty(text) == false)
            {
                HyperLink link = new HyperLink();
                link.ID   = idPrefix + propertyName;
                link.Text = Server.HtmlEncode(text);
                try
                {
                    link.NavigateUrl = Uri.EscapeUriString(text);
                }
                catch (UriFormatException)
                {
                    // Invalid url
                }

                column.Controls.Add(link);
            }
            row.Cells.Add(column);
        }