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; }
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; } } }