Exemplo n.º 1
0
        protected override void OnInit(EventArgs e)
        {
            using (LogGroup logGroup = LogGroup.Start("Initializing the EntityForm control.", NLog.LogLevel.Debug))
            {
                HeadingRow.CssClass = HeadingCssClass;
                Rows.AddAt(0, HeadingRow);
                HeadingRow.Cells.Add(HeadingCell);

                HeadingCell.Text       = HeadingText;
                HeadingCell.ColumnSpan = 2;

                foreach (TableRow row in Rows)
                {
                    LogWriter.Debug("Row type: " + row.GetType().ToString());

                    if (row is EntityFormButtonsItem)
                    {
                        EntityFormButtonsItem item = (EntityFormButtonsItem)row;

                        LogWriter.Debug("Binding item with field control ID: " + item.FieldControlID);

                        foreach (Control control in item.Cells[1].Controls)
                        {
                            if (control is Button)
                            {
                                HandleEvents((Button)control);
                            }
                        }
                    }
                    else if (row is EntityFormItem || row.GetType().BaseType == typeof(EntityFormItem))
                    {
                        EntityFormItem item = (EntityFormItem)row;

                        LogWriter.Debug("Binding item with field control ID: " + item.FieldControlID);

                        // If a custom CSS class hasn't been set on the object use the default one
                        if (item.TextCssClass != String.Empty)
                        {
                            item.TextCssClass = ItemTextCssClass;
                        }

                        foreach (Control control in item.Cells[1].Controls)
                        {
                            if (control is Button)
                            {
                                // HandleEvents((Button)control);
                            }
                        }
                    }
                    else if (row is TableRow)
                    {
                    }
                }
            }

            base.OnInit(e);
        }