Exemple #1
0
        protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
        {
            SetDeleteConfirmation(e.Row);

               GridViewRow row = e.Row;
               // Intitialize TableCell list
               List<TableCell> columns = new List<TableCell>();
               foreach (DataControlField column in GridView1.Columns)
               {
                    TableCell cell = row.Cells[0];
                    row.Cells.Remove(cell);
                    columns.Add(cell);
                    break;
               }

               // Add cells
               //row.Cells.AddRange(columns.ToArray());
        }
Exemple #2
0
        //-------------------------------------------------------------------------------------------
        void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
        {
            GridViewRow row = e.Row;
               // Intitialize TableCell list
               List<TableCell> columns = new List<TableCell>();
               //foreach (DataControlField column in GridView1.Columns)
               //{
               //     //Get the first Cell /Column
               //     TableCell cell = row.Cells[0];
               //     // Then Remove it after
               //     row.Cells.Remove(cell);
               //     //And Add it to the List Collections
               //     columns.Add(cell);
               //     cell.HorizontalAlign = HorizontalAlign.Center;
               //     cell.Width = Unit.Pixel(75);
               //}

               // Add cells
               row.Cells.AddRange(columns.ToArray());
        }
Exemple #3
0
        //-------------------------------------------------------------------------------------------
        protected override void OnLoad(EventArgs e)
        {
            IEnumerable<MetaColumn> columns = Table.GetScaffoldColumns(this.Mode, this.ContainerType);

               List<string> Groups = new List<string>();
               foreach (MetaColumn column in columns)
               {
                    this.currentColumn = column;

                    var groupattribute = column.GetAttribute<ColumnGroupAttribute>();
                    HtmlGenericControl tabContent = (HtmlGenericControl)GeneralControls;
                    if (groupattribute != null)
                    {
                         string groupId = groupattribute.GroupName.Replace(" ", "_");
                         if (!Groups.Contains(groupId))
                         {
                              Groups.Add(groupId);

                              var div = new HtmlGenericControl("div");
                              div.ID = groupId;
                              Tabs.Controls.Add(div);

                              LiteralControl tab = new LiteralControl();
                              tab.Text = "<li><a href=\"#" + div.ClientID + "\">" + groupattribute.GroupName + "</a></li>";
                              tabheader.Controls.Add(tab);
                         }
                         tabContent = (HtmlGenericControl)Tabs.FindControl(groupId);
                    }

                    HtmlGenericControl cellLine = new HtmlGenericControl("div");
                    cellLine.Attributes["class"] = "formLine";
                    tabContent.Controls.Add(cellLine);

                    HtmlGenericControl cellLabel = new HtmlGenericControl("div");
                    cellLabel.Attributes["class"] = "formLabel";
                    cellLabel.InnerText = column.DisplayName + ":";
                    cellLine.Controls.Add(cellLabel);

                    HtmlGenericControl cellData = new HtmlGenericControl("div");
                    cellData.Attributes["class"] = "formData";
                    var dynamicControl = new DynamicControl()
                    {
                         Mode = Mode,
                         DataField = column.Name,
                         ValidationGroup = this.ValidationGroup
                    };
                    cellData.Controls.Add(dynamicControl);
                    cellLine.Controls.Add(cellData);

                    HtmlGenericControl br = new HtmlGenericControl("div");
                    br.Style["clear"] = "both";
                    br.Style["height"] = "1px";
                    cellLine.Controls.Add(br);
               }

               var clearDiv = new HtmlGenericControl("div");
               clearDiv.InnerHtml = "&nbsp;";
               clearDiv.Style["clear"] = "both";
               GeneralControls.Controls.Add(clearDiv);

               //if (tabheader.Controls.Count == 1)
               //{
               //     tabheader.Controls.Clear();
               //}
               //else
               {
                    string script = "<script type='text/javascript'>$(document).ready(function () { $(\"#tableControl\").tabs(); });</script>";
                    ScriptManager.RegisterStartupScript(Page, GetType(), "TableControlInit", script, false);
               }
        }