By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,926 Members | 1,820 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,926 IT Pros & Developers. It's quick & easy.

custom data column headers, specific columns with web data grid

P: n/a
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 ]

gridTX.DataSource = ds.Tables[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.ItemStyle.Width=Convert.ToInt16(tabStyles.ta ble[tabIndex].columns[i].width);
Nov 16 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.