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:
="server">
>
="style2">
: 1147px;">
/>
"200px">
="text/css">
.hidden
{
;
}
Here is the code behind to hide or view the columns
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"
"State").CssClass = "hidden"
'wdgRecords.Columns("State").Header.CssClass = "hidden"
"RecordAmount").Width = 125
"RecordAmount").CssClass = "Right"
'wdgRecords.Columns("RecordAmount").Header.CssClass = "header"
"RecordDate").Width = 75
'wdgRecords.Columns("RecordDate").CssClass = "Center"
'wdgRecords.Columns("RecordDate").Header.CssClass = "header"
"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
"TemplateField_0").Width = 250
"TemplateField_0").CssClass = "Left"
'wdgRecords.Columns(
"TemplateField_0").Header.CssClass = "header"
"AgentName").Width = 250
"AgentName").CssClass = "Left"
"AgentName").Header.CssClass = "header"
"State").Width = 75
"State").CssClass = "Left"
"State").Header.CssClass = "header"
'wdgRecords.Columns("State").Width = 75
'wdgRecords.Columns("AgentCode").CssClass = "hidden"
"AgentCode").CssClass = "Center"
"AgentCode").Header.CssClass = "header"
Wow. What happened to the formatting on my first post? Anyway I forgot to add that it is the "company" selection in the if statement that is not working correctly. I inserted the screen as it appears when "company" is the one selected. As you can see the agent name header is showing up and the amount and year headers are not. It looks like the agent name header is extending to the end of the grid, no white vertical line after it.
Hi tharrell,
Instead of applying a css to attempt to hide the columns, why do you not use the grid's built in hidden column feature? Just set Hidden = true on a column on the aspx or code behind. This can also be changed on the client.
regards,
David Young