I have a Grid View and I am checking some permission on the Grid View
If the user don’t have permission. I am making the column invisible.
Grid View.Column[9].visible = false; //Zero based index so column 10 will be invisible.
The GridView doesn’t use GridView’s header (because of a specific
styling issue) but a separate html table.
the header is defined as follows
<tr>
<td width="5%" class="hier-header">Column 1</td>
<td width="10%" class="hier-header"> Column 2 </td>
<td width="10%" class="hier-header"> Column 3</td>
<td width="10%" class="hier-header"> Column 4</td>
<td width="5%" class="hier-header"> Column 5</td>
<td width="5%" class="hier-header"> Column 6</td>
<td width="10%" class="hier-header"> Column 7 </td>
<td width="15%" class="hier-header"> Column 8 </td>
<td width="5%" class="hier-header"> Column 9 </td>
<td width="5%" class="hier-header"> Column 10 </td>
<td width="5%" class="hier-header"> Column 11</td>
<td width="5%" class="hier-header">Column 12</td>
<td width="5%" class="hier-header">Column 13</td>
</tr>
In the above code I should make Column 10 not to show up. Is this doable?
Add a
runat="server"attribute to the<td>for Column 10 and give it an ID (likeid="column10Header"). Then you can set itsVisibleproperty tofalse.