sj1187534 Posted July 23, 2003 Posted July 23, 2003 Hi..Does anyone know how to hide a datagrid column that is created at runtime but not hard-coded??? I saw some articles that are talking about changing the visible property of the column. I guess that works only when the column is created within the code but not obtained from a dataset as it is in my case.. SJ Quote
Jeffe Posted July 28, 2003 Posted July 28, 2003 Hiding columns in a datagrid This is in C#... protected void Item_Bound(object sender, DataGridItemEventArgs e) { e.Items.Cells.[8].Visible = false; } ...where cell "8" is the one you want to hide. Note: You'll need to add OnItemDataBound="Item_Bound" to your HTML for the DataGrid, or insert it into whatever DataGrid argument you're currently using. Quote
donnacha Posted July 29, 2003 Posted July 29, 2003 If you are using the datagridstyle to set it up you can just leave the clume out of the style definition or if you want it to be in the grid and readable by your code but not visible just set the width for that column to 0. Quote Hamlet
sj1187534 Posted July 29, 2003 Author Posted July 29, 2003 Hi....Thanks for the replies guys. I was able to accomplish what I wanted by just making the AutoGenerateColumns property "False" and inserting the Databound columns manually...That seems the best thing to do. Thank u once again... SJ Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.