コード例 #1
0
ファイル: GridRow.cs プロジェクト: jeason0813/fineuiofMe
        /// <summary>
        /// 表格行中模板列控件列表(数据绑定时自动生成每个模板列控件ID,回发时从XState中回发模板列控件ID)
        /// </summary>
        public void InitTemplateContainers()
        {
            Collection <GridColumn> columns = _grid.AllColumns;

            TemplateContainers = new GridRowControl[columns.Count];

            for (int i = 0, count = columns.Count; i < count; i++)
            {
                GridColumn column = columns[i];
                if (column is TemplateField)
                {
                    TemplateField  field   = column as TemplateField;
                    GridRowControl control = new GridRowControl(DataItem, RowIndex);
                    // 不用指定ID,会自动生成类似 ct123 的唯一ID
                    //control.ID = String.Format("c{0}r{1}", column.ColumnIndex, RowIndex);

                    if (DataItem == null)
                    {
                        // 回发时恢复XState阶段(非数据绑定阶段),从Values中读取模板列的服务器ID(在第一次加载时自动生成的)
                        string fieldValue = Values[i];
                        if (fieldValue.StartsWith(Grid.TEMPLATE_PLACEHOLDER_PREFIX))
                        {
                            control.ID = fieldValue.Substring(Grid.TEMPLATE_PLACEHOLDER_PREFIX.Length);
                        }
                    }

                    field.ItemTemplate.InstantiateIn(control);

                    _grid.Controls.Add(control);
                    TemplateContainers[column.ColumnIndex] = control;
                }
            }
        }
コード例 #2
0
        internal override string GetColumnValue(GridRow row)
        {
            GridRowControl control = row.TemplateContainers[ColumnIndex];


            return(String.Format("#@TPL@#{0}", control.ClientID));
            //return String.Format("<div id=\"{0}_container\"></div>", control.ClientID);
            //string result = String.Empty;

            //if (_itemTemplate != null)
            //{
            //    StringBuilder output = new StringBuilder();
            //    using (StringWriter sw = new StringWriter(output, CultureInfo.CurrentCulture))
            //    {
            //        using (HtmlTextWriter htw = new HtmlTextWriter(sw))
            //        {
            //            //using (GridRowControl control = new GridRowControl(row.DataItem, row.RowIndex))
            //            //{
            //            //    _itemTemplate.InstantiateIn(control);
            //            //    control.ID = String.Format("{0}_{1}", Grid.ID, row.RowIndex);
            //            //    control.DataBind();

            //            //    control.RenderControl(htw);

            //            //}
            //            //GridRowControl control = row.TemplateContainers[ColumnIndex];
            //            //if (control != null)
            //            //{
            //            //    control.DataBind();
            //            //    //control.RenderControl(htw);
            //            //}
            //        }
            //    }

            //    result = output.ToString();
            //}

            //return result;
        }
コード例 #3
0
        public void InitTemplateContainers()
        {
            GridColumnCollection columns = _grid.AllColumns;

            TemplateContainers = new GridRowControl[columns.Count];

            for (int i = 0, count = columns.Count; i < count; i++)
            {
                GridColumn column = columns[i];
                if (column is TemplateField)
                {
                    TemplateField  field   = column as TemplateField;
                    GridRowControl control = new GridRowControl(DataItem, RowIndex);
                    //control.ID = String.Format("{0}_{1}_{2}", Grid.ID, RowIndex, column.ColumnIndex);
                    control.ID = String.Format("c{0}r{1}", column.ColumnIndex, RowIndex);

                    field.ItemTemplate.InstantiateIn(control);

                    Controls.Add(control);
                    TemplateContainers[column.ColumnIndex] = control;
                }
            }
        }
コード例 #4
0
        internal override string GetColumnValue(GridRow row)
        {
            GridRowControl control = row.TemplateContainers[ColumnIndex];

            return(String.Format("{0}{1}", Grid.TEMPLATE_PLACEHOLDER_PREFIX, control.ID));
        }
コード例 #5
0
ファイル: GridRow.cs プロジェクト: proson/Fine-UI
        /// <summary>
        /// �������ģ���пؼ��б�����ݰ�ʱ�Զ�����ÿ��ģ���пؼ�ID���ط�ʱ��FState�лط�ģ���пؼ�ID��
        /// </summary>
        public void InitTemplateContainers()
        {
            Collection<GridColumn> columns = _grid.AllColumns;
            TemplateContainers = new GridRowControl[columns.Count];

            for (int i = 0, count = columns.Count; i < count; i++)
            {
                GridColumn column = columns[i];
                if (column is TemplateField)
                {
                    TemplateField field = column as TemplateField;
                    GridRowControl control = new GridRowControl(DataItem, RowIndex);

                    // ����ָ��ID�����Զ��������� ct123 ��ΨһID
                    //control.ID = String.Format("c{0}r{1}", column.ColumnIndex, RowIndex);

                    if (DataItem == null)
                    {
                        // �ط�ʱ�ָ�FState�׶Σ������ݰ󶨽׶Σ�����Values�ж�ȡģ���еķ�����ID���ڵ�һ�μ���ʱ�Զ����ɵģ�
                        string fieldValue = Values[i];
                        if (fieldValue.StartsWith(Grid.TEMPLATE_PLACEHOLDER_PREFIX))
                        {
                            control.ID = fieldValue.Substring(Grid.TEMPLATE_PLACEHOLDER_PREFIX.Length);
                        }
                    }

                    field.ItemTemplate.InstantiateIn(control);

                    _grid.Controls.Add(control);
                    TemplateContainers[column.ColumnIndex] = control;

                }

            }
        }
コード例 #6
0
ファイル: GridRow.cs プロジェクト: jinwmmail/RDFNew
        public void InitTemplateContainers()
        {
            Collection<GridColumn> columns = _grid.AllColumns;
            TemplateContainers = new GridRowControl[columns.Count];

            for (int i = 0, count = columns.Count; i < count; i++)
            {
                GridColumn column = columns[i];
                if (column is TemplateField)
                {
                    TemplateField field = column as TemplateField;
                    GridRowControl control = new GridRowControl(DataItem, RowIndex);
                    //control.ID = String.Format("{0}_{1}_{2}", Grid.ID, RowIndex, column.ColumnIndex);
                    control.ID = String.Format("c{0}r{1}", column.ColumnIndex, RowIndex);

                    field.ItemTemplate.InstantiateIn(control);

                    Controls.Add(control);
                    TemplateContainers[column.ColumnIndex] = control;

                }

            }
        }