header text in datagrid

Results 1 to 2 of 2

Thread: header text in datagrid

  1. #1
    Join Date
    Dec 1969

    Default header text in datagrid

    Hi <BR><BR>How to display header text dynamically in datagrid means<BR>based on condition i want to dispaly the headet text.<BR>here giving the example.<BR>Below cntname is variable having the actual header text.<BR><BR>&#060;asp:datagrid id="grd" Runat="server"&#062; &#060;Columns&#062;<BR> &#060;asp:TemplateColumn ItemStyle-Width="4px" HeaderText=&#060;%=cntname%&#062; HeaderStyle-Font-Size="10px" ItemStyle-Font-Size="8"&#062;<BR> &#060;/asp:TemplateColumn&#062;<BR><BR>when i do this its diplaying blank header eventhough variable cntname having value.<BR><BR>pl help me<BR>thanks

  2. #2
    Join Date
    Dec 1969

    Default RE: header text in datagrid

    What determines if the header is displayed is a bool value set in the DataGrid opening tag, example... &#060;asp:datagrid id="grd" ShowHeader="False" Runat="server"&#062; will render a dataGrid with no header. Now if you want to toggle the header based on some value then fine. In page load do this...<BR><BR>If(cntname == "whatever")<BR>grd.ShowHeader = true;<BR>else<BR>grd.ShowHeader = false; <BR><BR>Now the tricky part is getting the value of "cntname" from ur data lol.<BR><BR>Hope that helps :p

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts