B
Bob Avallone
I hope this is the best forum for this questions
I am binding a datatable to a datagrid, but I want to hide column zero.
I got this code to work with a windows based data grid but it does not work
with a webform. Please help.
dtgResults.DataSource = mcloResults.GetDataTable()
dtgResults.DataBind()
Public Function GetDataTable() As DataTable
Try
mdtAny = mdsAny.Tables(0)
mdtAny.Columns(0).ColumnMapping = MappingType.Hidden
Return mdtAny
Catch excAny As Exception
gcloGetMessage.DisplayError(excAny)
Return Nothing
Exit Function ' bExecuteCommand
End Try
End Function
Here is the html for the datagrid
<asp
ataGrid id="dtgResults" runat="server" Width="800px" Height="149px"
BorderColor="Tan" BorderWidth="1px"
BackColor="LightGoldenrodYellow" CellPadding="2" ForeColor="Blue"
AllowPaging="True" BorderStyle="Solid">
<SelectedItemStyle ForeColor="GhostWhite"
BackColor="DarkSlateBlue"></SelectedItemStyle>
<AlternatingItemStyle BackColor="PaleGoldenrod"></AlternatingItemStyle>
<ItemStyle Height="20px" Width="20px"></ItemStyle>
<HeaderStyle Font-Bold="True" BorderWidth="20px" BorderStyle="Solid"
BackColor="Tan"></HeaderStyle>
<FooterStyle BackColor="Tan"></FooterStyle>
<PagerStyle VerticalAlign="Middle" HorizontalAlign="Left"
ForeColor="DarkSlateBlue" BackColor="PaleGoldenrod"></PagerStyle>
</asp
ataGrid></P>
I am binding a datatable to a datagrid, but I want to hide column zero.
I got this code to work with a windows based data grid but it does not work
with a webform. Please help.
dtgResults.DataSource = mcloResults.GetDataTable()
dtgResults.DataBind()
Public Function GetDataTable() As DataTable
Try
mdtAny = mdsAny.Tables(0)
mdtAny.Columns(0).ColumnMapping = MappingType.Hidden
Return mdtAny
Catch excAny As Exception
gcloGetMessage.DisplayError(excAny)
Return Nothing
Exit Function ' bExecuteCommand
End Try
End Function
Here is the html for the datagrid
<asp
BorderColor="Tan" BorderWidth="1px"
BackColor="LightGoldenrodYellow" CellPadding="2" ForeColor="Blue"
AllowPaging="True" BorderStyle="Solid">
<SelectedItemStyle ForeColor="GhostWhite"
BackColor="DarkSlateBlue"></SelectedItemStyle>
<AlternatingItemStyle BackColor="PaleGoldenrod"></AlternatingItemStyle>
<ItemStyle Height="20px" Width="20px"></ItemStyle>
<HeaderStyle Font-Bold="True" BorderWidth="20px" BorderStyle="Solid"
BackColor="Tan"></HeaderStyle>
<FooterStyle BackColor="Tan"></FooterStyle>
<PagerStyle VerticalAlign="Middle" HorizontalAlign="Left"
ForeColor="DarkSlateBlue" BackColor="PaleGoldenrod"></PagerStyle>
</asp