|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Hidden column in datagridI have a datasource in datatable or dataset I want to hide one of the column
how can I do this? thanks. The datagrid allows you either to specify columns (using templates) to
display or to have the columns generated dynamically (by setting the AutoGenerateColumns property value to true). If you list your columns, then you can change the style for each column while handling the ItemDataBound event Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As DataGridItemEventArgs) Handles dgProdPercentDim.ItemDataBound, dgProdPercentPet.ItemDataBound If e.Item.ItemType = ListItemType.Item Or _ e.Item.ItemType = ListItemType.AlternatingItem Or _ e.Item.ItemType = ListItemType.Header Then Dim drv As DataRowView = CType(e.Item.DataItem, DataRowView) Dim i As Integer For i = 0 To drv.Row.Table.Columns.Count - 1 Select Case drv.Row.Table.Columns(i).ColumnName.ToUpper Case "SUPPLIER", "PRODID", "DESTINATION" 'hide the cells that correspond to those datatable field names e.Item.Cells(i).CssClass = "Hidden" Case Else 'assign a different style e.Item.Cells(i).CssClass = "RightAlign" End Select Next End If End Sub Then in your CSS you would define Hidden as <style> ..Hiden{display:none;} </style> Show quoteHide quote "amos" wrote: > I have a datasource in datatable or dataset I want to hide one of the column > how can I do this? > thanks.
Trouble with validator control ? Script not found
Is there a free .GIF software? ASP.NET 2.0 DataView DetailsView ImageField displaying images from Trouble with validator control ? script not found Display data in asp:Calendar servercontrols (webcontrols, htmlcontrols) or html elements? Gridview and colspan Scroll position in panel control Adding AutoPostBack to a webcontrol Changing RadioButton's NAme and ID properties using vb.net |
|||||||||||||||||||||||