469,962 Members | 2,341 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,962 developers. It's quick & easy.

custom data column headers, specific columns with web data grid

After I made a nice application with WINFORM I tried to apply much of the same code, but there are lost of differences.

I load the grid colors, column width, column header from a xml data file.
But when I use datagrid.bind - it pulls in all the data to its own columns.
[ I want to apply the style and not show some columns ]

Ex:
gridTX.DataSource = ds.Tables[mappTableName];
this.AttachXMLdrivenStyle(gridTX,mappTableName);
gridTX.DataBind(); // my columns are not mapped over....but stand alone.
// best way to do this ??? there is no mapping name
// as in the winform....

private void AttachXMLdrivenStyle(System.Web.UI.WebControls.Dat aGrid gridTX,string mapTableName)
{ // read the definitions for the table styles...
gridTX.BackColor= this.getBackColor(mapTableName);
gridTX.AlternatingItemStyle.BackColor = this.getAlternatingBackColor(mapTableName);
int tabIndex = this.getStyleIndex(mapTableName);
int numCols= tabStyles.table[tabIndex].columns.GetLength(0);

for (int i =0;i< numCols;i++)
{ System.Web.UI.WebControls.DataGridColumn dgCol;
System.Web.UI.WebControls.BoundColumn bCol = new System.Web.UI.WebControls.BoundColumn();
dgCol=bCol;
dgCol.ItemStyle.Width=Convert.ToInt16(tabStyles.ta ble[tabIndex].columns[i].width);
dgCol.HeaderText=tabStyles.table[tabIndex].columns[i].headertext;;
gridTX.Columns.Add(dgCol);
}
Nov 16 '05 #1
0 1515

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by David Veeneman | last post: by
7 posts views Thread by Girish | last post: by
6 posts views Thread by Bob The Builder | last post: by
2 posts views Thread by schaapiee | last post: by
6 posts views Thread by insirawali | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.