RE: DataGrid - how to configure columns in C# code?
- From: "srini" <srini@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 20 Oct 2005 04:34:02 -0700
Hi Bond,
You can download some sample code which illustrates the same here
http://www.expertszone.com/samples/checkboxdatagrid.zip
Hope that helps ..
--
The best
srini
http://www.expertszone.com
"Dmitry Bond." wrote:
> Hello All.
>
> Could you please help me with DataGrid?
> The situation is the following:
> I have a DataSet with some data to display in DataGrid.
> In the configuration file I have a (comma-separated) list of columns of that
> DataSet to display.
> The first column in DataGrid should contains checkbox, rest of columns
> should be configured at run-time.
> How can I do this?
>
> Just to give you an idea I provide a piece of code:
>
> private void gridReports_DataBinding(object sender, System.EventArgs e)
> {
> this.reportsView = new
> DataView(this.reportsTabs.Tables[this.selectedTableIndex]);
> this.reportsView.Sort = "title";
> gridReports.DataSource = this.reportsView;
>
> // get list of columns to display
> ArrayList colList =
> (this.ReportsEngineObj.GetMetadataItem("ReportsListColumns") as ArrayList);
> // if not available - init default
> if (colList == null)
> {
> colList = new ArrayList();
> colList.Add("title");
> }
> foreach (string colName in colList)
> {
> TemplateColumn gc = new TemplateColumn();
> gc.HeaderText = "<b>" + colName + "</b>";
> gc.ItemTemplate = ???!!! <<=== here I have problems! I just do not
> know what should be here...
> gridReports.Columns.Add(gc);
> }
> }
>
> I browse MSDN but samples I found have predefined set of columns defined in
> ASPX file.
> But I need to configure columns in C# code...
> How can I do this?
>
>
> WBR, Dmitry.
>
>
>
.
- References:
- DataGrid - how to configure columns in C# code?
- From: Dmitry Bond.
- DataGrid - how to configure columns in C# code?
- Prev by Date: Re: response.redirect & response.end
- Next by Date: Re: I've got doubt about MARS feature support in ASP.NET 2.0 and MSSQL 2.0
- Previous by thread: DataGrid - how to configure columns in C# code?
- Next by thread: Re: Tab Index
- Index(es):
Relevant Pages
|