Header not showing in DataGrid

Answered (Verified) This post has 1 verified answer and 4 replies

Not Ranked
Posts: 5
aerykian Posted: Tue Mar 13, 2012 @ 3:45 PM
Greetings!

I'm having difficulty getting the grid to show column headers.  I've tried creating a client template for the heading, and using the same CSS with an ASP.Net datagrid - which shows the heading without any issies.  I'm using product version 2009.3.1762.35.  I'm defining the grid as follows:

<CA:DataGrid
	id="gridStudent"
	CssClass="Grid"
	EnableViewState="true"
	ShowFooter="true"
	FooterCssClass="GridFooter"
	RunningMode="Client"
	Width="270"
	Height="400"
	EmptyGridText="No enrolled classes"
	runat="server">
	<Levels>
		<CA:GridLevel
			DataKeyField="UserLoginID"
			ShowHeadingCells="true"
			HeadingRowCssClass="GridHeader"
			RowCssClass="GridItem">
			<Columns>
				<CA:GridColumn DataField="UserLoginID" Visible="false" />
				<CA:GridColumn HeadingText="Student ID" DataField="DispStudentID" Width="90" Align="Left" FixedWidth="true" />
				<CA:GridColumn HeadingText="Name" DataField="DisplayName" Width="180" FixedWidth="true" />
			</Columns>
		</CA:GridLevel>
	</Levels>
</CA:DataGrid>

Firebug shows the grid is populating as expected.  Am I missing something?  Any help is greatly appreciated.

Answered (Verified) Verified Answer

Not Ranked
Posts: 5
Answered (Verified) aerykian Posted: Tue Mar 20, 2012 @ 4:48 AM
Verified by aerykian
Okay,
Your code worked.  I compared the ComponentArt grids to see what was different and couldn't find anything.  Then I compared settings in web.config, and the only thing different was that I had it set to ClientIDMode="Static", and not "Auto-ID".  Once I changed the ClientIDMode, it worked fine. 

Hopefully this thread will save someone else some time one day  :)

All Replies

Top 10 Contributor
Posts: 908
ajay Posted: Wed Mar 14, 2012 @ 5:42 AM

Hello,

 

Thank you for submitting your query with ComponentArt forum.

 

You need to set the ShowHeader property to true for displaying header in Grid.

 

Please refer the following inbuilt sample application for the same:


http://aspnetajax.componentart.com/control-specific/datagrid/features/core_features/default.aspx

 

Hope it will help you.

 

Thank you.

 

Ajay Mishra

Not Ranked
Posts: 5
aerykian Posted: Wed Mar 14, 2012 @ 7:50 AM
Hello!  Thank you for responding.  I've added 'ShowHeader="true"' to the grid definition, and the heading cells are still not showing.  The rendered HTML shows that a blank space is being entered for the header items:

<table cellspacing="0" cellpadding="0" border="0" style="height:400px;width:270px;" class="Grid" id="ctl00_ContentPlaceHolder1_gridStudent">
    <tbody>
        <tr>
            <td id="ctl00_ContentPlaceHolder1_gridStudent_header"></td>
        </tr>
        <tr>
            <td valign="top" style="vertical-align:top;" id="ctl00_ContentPlaceHolder1_gridStudent_dom">&nbsp;</td>
        </tr>
        <tr>
            <td id="ctl00_ContentPlaceHolder1_gridStudent_footer" class="GridFooter"></td>
        </tr>
    </tbody>
</table>

In the CDATA section, the grid's .Data property shows five rows of test data, with three columns.
Top 10 Contributor
Posts: 908
ajay Posted: Wed Mar 14, 2012 @ 11:37 AM

Hello,

 

Thanks for getting back to me.

 

Please find the attached sample application to show the header in Grid. I have tested it in ComponentArt version 2009.3.1762.35. Please test it and see if you are missing anything.

 

Thank you.

 

Ajay Mishra

Not Ranked
Posts: 5
Answered (Verified) aerykian Posted: Tue Mar 20, 2012 @ 4:48 AM
Verified by aerykian
Okay,
Your code worked.  I compared the ComponentArt grids to see what was different and couldn't find anything.  Then I compared settings in web.config, and the only thing different was that I had it set to ClientIDMode="Static", and not "Auto-ID".  Once I changed the ClientIDMode, it worked fine. 

Hopefully this thread will save someone else some time one day  :)
Page 1 of 1 (5 items)