Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
195
problem with column header width
posted

I am having a problem with the column header not getting set to invisible when I set it.  I have created and am using a cssClass as recommended on this forum in another post.  This is working for several columns but not for one of them.  The column will be hidden but not the header for this particular column.  As far as I can tell all of the columns are the same.  Can anyone tell me why this will work for some columns and not the one?

Here is the source code for the table:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

<asp:UpdatePanel ID="UpdatePanel1" runat

="server">

 

 

 

<ContentTemplate

>

 

 

 

<tr

>

 

 

 

<td style="text-align: right; " class="style1">Hierarchy Level :</td

>

 

 

 

<td style="text-align: left; padding: 3px;" class

="style2">

 

 

 

<asp:DropDownList ID="ddHierarchy" runat="server" AutoPostBack="True" Height="24px" Width="115px"> </asp:DropDownList

>

 

 

 

</td>

 

 

 

</tr

>

 

 

 

<div id="OverallGrid" runat="server" style=" margin-top: 10px; width

: 1147px;">

 

 

 

&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;

&nbsp;&nbsp;

 

 

 

<div id="test1" runat

="server">

 

 

 

<ig:WebDataGrid ID="wdgRecords" runat="server" AltItemCssClass="altrow" AutoGenerateColumns="False">

 

 

 

<Columns

>

 

 

 

<ig:TemplateDataField Key="TemplateField_0" CssClass="Left" Width = "200px"

>

 

 

 

<Header Text="Record Type" CssClass="header"

/>

 

 

 

</ig:TemplateDataField

>

 

 

 

<ig:BoundDataField DataFieldName="AgentName" Key="AgentName" CssClass="Center" Width =

"200px">

 

 

 

<Header Text="Agent Name" CssClass="header"

/>

 

 

 

</ig:BoundDataField

>

 

 

 

<ig:BoundDataField DataFieldName="State" Key="State" CssClass="Center" Width = "200px"

>

 

 

 

<Header Text="State" CssClass="header"

/>

 

 

 

</ig:BoundDataField

>

 

 

 

<ig:BoundDataField DataFieldName="RecordAmount" Key="RecordAmount" CssClass="Center" Width =

"200px">

 

 

 

<Header Text="Amount/Count" CssClass="header"

/>

 

 

 

</ig:BoundDataField

>

 

 

 

<ig:BoundDataField DataFieldName="RecordDate" Key="RecordDate" CssClass="Center" Width =

"200px">

 

 

 

<Header Text="Record Date" CssClass="header"

/>

 

 

 

</ig:BoundDataField

>

 

 

 

<ig:BoundDataField DataFieldName="AgentCode" Key="AgentCode" CssClass="Center" Width =

"200px">

 

 

 

<Header Text="Agency Number" CssClass="header"

/>

 

 

 

</ig:BoundDataField

>

 

 

 

</Columns

>

 

 

 

</ig:WebDataGrid

>

 

 

 

</div

>

 

 

 

 

<style type

="text/css">

 

 

 

.hidden

{

 

 

 

display:none

;

}

 

 

 

</style

>

 

 

 

 

<br

/>

 

 

 

<br

/>

 

 

 

<br

/>

 

 

 

<ig:WebExcelExporter ID="eExcelExporter" runat="server"

 

 

 

DataExportMode="AllDataInDataSource" DownloadName="RecordMonth"

 

 

 

EnableStylesExport="true" ExportMode="Download"

/>

 

 

 

 

</div

>

 

 

 

</ContentTemplate

>

 

 

 

 

</asp:UpdatePanel

>

Here is the code behind to hide or view the columns

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

If ddHierarchy.SelectedValue.ToLower = "Company".ToLower

Then

 

 

 

'1. Column order: Record Type, Amount, Year

 

 

 

 

 

 

 

'wdgRecords.Columns("TemplateField_0").Width = 250

 

 

 

'wdgRecords.Columns("TemplateField_0").CssClass = "Left"

 

 

 

'wdgRecords.Columns("TemplateField_0").Header.CssClass = "header"

 

wdgRecords.Columns(

 

"AgentName").CssClass = "hidden"

 

 

 

'wdgRecords.Columns("AgentName").Header.CssClass = "hidden"

 

 

 

'wdgRecords.Columns("AgentName").Width = -1

 

 

 

'wdgRecords.Columns("AgentName").Header.Text = ""

 

 

 

'wdgRecords.Columns("AgentName").CssClass = "Left"

 

 

 

'wdgRecords.Columns("AgentName").Header.CssClass = "header"

 

 

 

''wdgRecords.Columns(1).Header.CssClass = "hidden"

 

 

 

''wdgRecords.Columns(1).CssClass = "hidden"

 

 

 

'wdgRecords.Columns("State").Header.CssClass = "header"

 

 

 

'wdgRecords.Columns("State").CssClass = "Left"

wdgRecords.Columns(

 

"State").CssClass = "hidden"

 

 

 

'wdgRecords.Columns("State").Header.CssClass = "hidden"

 

 

wdgRecords.Columns(

 

"RecordAmount").Width = 125

wdgRecords.Columns(

 

"RecordAmount").CssClass = "Right"

 

 

 

'wdgRecords.Columns("RecordAmount").Header.CssClass = "header"

wdgRecords.Columns(

 

"RecordDate").Width = 75

 

 

 

'wdgRecords.Columns("RecordDate").CssClass = "Center"

 

 

 

'wdgRecords.Columns("RecordDate").Header.CssClass = "header"

wdgRecords.Columns(

 

"AgentCode").CssClass = "hidden"

 

 

 

'wdgRecords.Columns("AgentCode").Header.CssClass = "hidden"

 

 

 

'wdgRecords.Columns("AgentCode").CssClass = "Center"

 

 

 

'wdgRecords.Columns("AgentCode").Header.CssClass = "header"

 

 

 

 

Else

 

 

 

'3. Column order: Record Type, County Name (AM name), State, Amount, Year

wdgRecords.Columns(

 

"TemplateField_0").Width = 250

wdgRecords.Columns(

 

"TemplateField_0").CssClass = "Left"

'wdgRecords.Columns(

 

"TemplateField_0").Header.CssClass = "header"

wdgRecords.Columns(

 

"AgentName").Width = 250

wdgRecords.Columns(

 

"AgentName").CssClass = "Left"

'wdgRecords.Columns(

 

"AgentName").Header.CssClass = "header"

wdgRecords.Columns(

 

"State").Width = 75

wdgRecords.Columns(

 

"State").CssClass = "Left"

'wdgRecords.Columns(

 

"State").Header.CssClass = "header"

 

 

 

'wdgRecords.Columns("State").Width = 75

 

 

 

'wdgRecords.Columns("State").CssClass = "Left"

 

 

 

'wdgRecords.Columns("State").Header.CssClass = "header"

wdgRecords.Columns(

 

"RecordAmount").Width = 125

wdgRecords.Columns(

 

"RecordAmount").CssClass = "Right"

wdgRecords.Columns(

 

"RecordDate").Width = 75

 

 

 

'wdgRecords.Columns("AgentCode").CssClass = "hidden"

 

 

 

'wdgRecords.Columns("AgentCode").Header.CssClass = "hidden"

wdgRecords.Columns(

 

"AgentCode").CssClass = "Center"

'wdgRecords.Columns(

 

"AgentCode").Header.CssClass = "header"

 

 

 

End If