Example #1
0
        private DucBaseControl BindSubjectField(SubjectFieldDto field)
        {
            string virtualPath = string.Format(ServerPath + DucBaseControl.ControlURLFormatString, field.DucType);

            DucBaseControl ducControl = (DucBaseControl)Page.LoadControl(virtualPath);

            return(ducControl);
        }
Example #2
0
        protected void CreateLayout(HtmlTable subjectLayoutPlace, SubjectLoadMode loadMode)
        {
            // create rows/cells according to layout information
            if (CurrentSubject.RowIndexMax > 0 && CurrentSubject.ColIndexMax > 0)
            {
                for (int rowIndex = 1; rowIndex <= CurrentSubject.RowIndexMax; rowIndex++)
                {
                    HtmlTableRow row = new HtmlTableRow();
                    row.Height = "22";
                    subjectLayoutPlace.Rows.Add(row);
                    for (int cellIndex = 1; cellIndex <= CurrentSubject.ColIndexMax; cellIndex++)
                    {
                        HtmlTableCell cell = new HtmlTableCell();
                        cell.VAlign = "middle";
                        cell.Align  = "left";
                        row.Cells.Add(cell);
                    }
                }
            }

            // bind SubjectField to rows/cells
            foreach (SubjectFieldDto field in CurrentSubject.SubjectFields)
            {
                if (field.RowIndex > 0 && field.ColIndex > 0)
                {
                    HtmlTableCell aCell = subjectLayoutPlace.Rows[field.RowIndex - 1].Cells[field.ColIndex - 1];

                    DucBaseControl ducControl = BindSubjectField(field);
                    if (ducControl != null)
                    {
                        aCell.Controls.Add(ducControl);
                        ducControl.SubjectField = field;
                        ducControl.LoadMode     = loadMode;
                        if (field.FieldKey.Equals(ControlledFieldName, StringComparison.OrdinalIgnoreCase))
                        {
                            ducControl.Disabled = true;
                        }

                        _ducControlCollection.Add(ducControl);
                    }
                }
            }
        }