countrymeister
asked on
How to hide / show a datagrid column
I have a datagrid with a few columns. In my ItemDatabound event I would like to show the CollectionDate column based on certain condiition, how do I access the bound column in the item data bound event. The default visibility is set to false for this Collection Date cplumn
<Columns>
<asp:TemplateColumn HeaderText="Patient Name" >
<ItemTemplate >
<asp:HyperLink ID="hlPatientName" runat="server" NavigateUrl='<%# Eval("PatientId","Patients.aspx?PatientId={0}" ) %>'
Text='<%# Eval("PatientName") %>'></asp:HyperLink>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn HeaderText="Patient ID" DataField="PatientId" Visible="false">
</asp:BoundColumn>
<asp:BoundColumn HeaderText="OrderID" DataField="Accession" Visible="true">
</asp:BoundColumn>
<asp:BoundColumn HeaderText="Physician Name" DataField="PhysicianName" Visible="true">
</asp:BoundColumn>
<asp:BoundColumn HeaderText="Collection Date" DataField="CollectionDate" DataFormatString="{0:MM/dd/yyyy}" Visible="false">
</asp:BoundColumn>
</Columns>
ASKER
i want to hide the column
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Do you want to hide the entire column based on the values of individual rows? or just not show the value of the column for some rows depending on the row values?