This is a migrated thread and some comments may be shown as answers.

Grouping when there are no rows in the grid

1 Answer 81 Views
Grid
This is a migrated thread and some comments may be shown as answers.
GoodLevitation
Top achievements
Rank 1
GoodLevitation asked on 02 Jan 2008, 03:02 PM
Normally, one would not do grouping when there are no rows in the grid control.  But if you do, then the grid columns' widths fall off the page. 

Now what would be the best approach for me to handle it?  I'm using "Prometheus" on WinXP.  And below is my code...

<

table width="99%" cellspacing="0" cellpadding="0" border="0" style="border-spacing:0; border:0; height:15" >

<tr style="border-spacing:0; border:0">

<td>

<csla:CslaDataSource ID="dsCollateralList" runat="server" TypeName="WVFacts.CPS.Intake"

TypeAssemblyName="WVFacts.CPS.Intake.GnrlColtrlList" OnSelectObject="dsCollateralList_SelectObject">

</csla:CslaDataSource>

<facts:FACTSGrid ID="dgrdColtrl" runat="server" DataSourceID="dsCollateralList"

GridLines="None" Height="120px" ShowGroupPanel="True" CellSpacing="0" AllowSorting="True"

OnPreRender="SelectRow" CellPadding="0" OnGroupsChanging="dgrdColtrl_GroupChange"

OnItemCommand="dgrdColtrl_ItemCommand" AutoGenerateColumns="False"

>

<clientsettings reordercolumnsonclient="True" allowcolumnhide="True"

enablepostbackonrowclick="True" allowdragtogroup="True">

<Scrolling UseStaticHeaders="True" AllowScroll="True" ScrollHeight="80px"></Scrolling>

<Selecting AllowRowSelect="True" />

<ClientEvents OnGridCreated="ScrollToRow" />

<Resizing AllowRowResize="True" AllowColumnResize="True" EnableRealTimeResize="True">

</Resizing>

</clientsettings>

<mastertableview datasourceid="dsCollateralList" datakeynames="CollateralId" AllowNaturalSort="true"

allowcustompaging="True" pagesize="20" AllowMultiColumnSorting="true">

<Columns>

<radG:GridBoundColumn DataField="CollateralId" UniqueName="CollateralId"

HeaderText="Id" visible="true" HeaderStyle-Width="70">

</radG:GridBoundColumn>

<radG:GridBoundColumn DataField="CollateralName" SortExpression="CollateralName" HeaderText="Name"

UniqueName="CollateralName">

</radG:GridBoundColumn>

<radG:GridBoundColumn DataField="RelationDescription" SortExpression="RelationDescription"

HeaderText="Relationship" UniqueName="RelationDescription">

</radG:GridBoundColumn>

<radG:GridBoundColumn DataField="FormattedHomePhone" SortExpression="FormattedHomePhone"

HeaderText="Home Phone" UniqueName="FormattedHomePhone" HeaderStyle-Width="120">

</radG:GridBoundColumn>

<radG:GridBoundColumn DataField="FormattedBussinessPhone" SortExpression="FormattedBussinessPhone"

HeaderText="Business Phone" UniqueName="FormattedBussinessPhone" HeaderStyle-Width="120">

</radG:GridBoundColumn>

</Columns>

<ExpandCollapseColumn Visible="False">

<HeaderStyle Width="19px" />

</ExpandCollapseColumn>

<RowIndicatorColumn Resizable="True">

<HeaderStyle Width="20px" />

</RowIndicatorColumn>

</mastertableview>

<grouppanel visible="True">

</grouppanel>

</facts:FACTSGrid>

</td>

</tr>

</table>



1 Answer, 1 is accepted

Sort by
0
Nikita Gourme
Top achievements
Rank 1
answered on 04 Jan 2008, 04:36 PM
The easiest method that comes to my mind is to set ShowHeadersWhenNoRecords to false for the master table. Thus when there is no data to be displayed only the no records template will be rendered and the end user will not be able to group columns.

Hope this makes sense.

Nikita
Tags
Grid
Asked by
GoodLevitation
Top achievements
Rank 1
Answers by
Nikita Gourme
Top achievements
Rank 1
Share this question
or