Hello Group,
I have a question about the radgrid control. The problem is that when I add templatecolumns to the grid from a datatable programmacally then columns aren't visible. The only way there are visible is when I connect de radgrid to an sqldatasource. But the when i click a link in the grid the complete grid vanishes.
Code for the first grid: this one binds fine although very slow but thats is another question.
<telerik:RadGrid ID="RgNav" runat="server" CellSpacing="0" DataSourceID="SDS_PPB_Project"
GridLines="None" Skin="Default" AutoGenerateColumns="false" CssClass="PpbNav">
<MasterTableView DataSourceID="SDS_PPB_Project" DataKeyNames="DossierCode" HeaderStyle-Height="48"
HierarchyDefaultExpanded="true">
<DetailTables>
<telerik:GridTableView AutoGenerateColumns="false" DataSourceID="SDS_PPB_Sales" Width="100%"
DataKeyNames="DetailCode,DetailSubCode" ShowHeadersWhenNoRecords="false" HierarchyDefaultExpanded="false">
<DetailTables>
<telerik:GridTableView DataSourceID="SDS_PPB_ProdDossiers" AutoGenerateColumns="false"
DataKeyNames="DetailCode,DetailSubCode,ProdHeaderDossierCode" HierarchyDefaultExpanded="false">
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="DetailCode" MasterKeyField="DetailCode" />
<telerik:GridRelationFields DetailKeyField="DetailSubCode" MasterKeyField="DetailSubCode" />
</ParentTableRelation>
<Columns>
<telerik:GridBoundColumn DataField="ProdHeaderDossierCode" HeaderText="ProdDossier">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ProdStatusCode" HeaderText="StatusCode">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="PhQty" HeaderText="Aantal">
</telerik:GridBoundColumn>
</Columns>
<DetailTables>
<telerik:GridTableView AutoGenerateColumns="false" DataSourceID="SDS_PPB_Operations"
Width="100%" DataKeyNames="ProdHeaderDossierCode" ShowHeadersWhenNoRecords="false"
HierarchyDefaultExpanded="false">
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="ProdHeaderDossierCode" MasterKeyField="ProdHeaderDossierCode" />
</ParentTableRelation>
<Columns>
<telerik:GridBoundColumn DataField="MachGrpCode" HeaderText="Bew.">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ProdBooStatusCode" HeaderText="StatusCode">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="MachPlanTime" HeaderText="Bew.PT">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="OperStartedInd" HeaderText="Gestart">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="OperFinishedInd" HeaderText="Gereed">
</telerik:GridBoundColumn>
</Columns>
</telerik:GridTableView>
</DetailTables>
</telerik:GridTableView>
</DetailTables>
<Columns>
<telerik:GridBoundColumn DataField="DetailCode" HeaderText="Vk.Rgl">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="DetailSubCode" HeaderText="SubRgl">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="DDDescription" HeaderText="Omschrijving">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="DDCalcQty" HeaderText="Aantal">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="DDCompletedInd" HeaderText="Gereed">
</telerik:GridBoundColumn>
</Columns>
<DetailTables>
<telerik:GridTableView AutoGenerateColumns="false" DataSourceID="SDS_PPB_Delivery"
Width="100%" DataKeyNames="DetailCode,DetailSubCode,DelMainCode" ShowHeadersWhenNoRecords="false"
HierarchyDefaultExpanded="false">
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="DetailCode" MasterKeyField="DetailCode" />
<telerik:GridRelationFields DetailKeyField="DetailSubCode" MasterKeyField="DetailSubCode" />
</ParentTableRelation>
<Columns>
<telerik:GridBoundColumn DataField="DelMainCode" HeaderText="HVS">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="DelDescription" HeaderText="Omschrijving">
</telerik:GridBoundColumn>
</Columns>
<DetailTables>
<telerik:GridTableView AutoGenerateColumns="false" DataSourceID="SDS_PPB_DeliveryLines"
Width="100%" DataKeyNames="DelMainCode" ShowHeadersWhenNoRecords="false" HierarchyDefaultExpanded="false">
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="DelMainCode" MasterKeyField="DelMainCode" />
</ParentTableRelation>
<Columns>
<telerik:GridBoundColumn DataField="DelLineQty" HeaderText="Aantal">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="DelLineCompletedInd" HeaderText="Gereed">
</telerik:GridBoundColumn>
</Columns>
</telerik:GridTableView>
</DetailTables>
</telerik:GridTableView>
</DetailTables>
</telerik:GridTableView>
</DetailTables>
<Columns>
<telerik:GridBoundColumn DataField="QuotNr" HeaderText="OfferteNr.">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="OrdNr" HeaderText="OrdNr.">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="DmDescription" HeaderText="Project">
</telerik:GridBoundColumn>
</Columns>
<DetailTables>
<telerik:GridTableView AutoGenerateColumns="false" DataSourceID="SDS_PPB_AllDelivery"
Width="100%" DataKeyNames="DelMainCode" ShowHeadersWhenNoRecords="false">
<Columns>
<telerik:GridBoundColumn DataField="DelMainCode" HeaderText="HVS">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="DelDescription" HeaderText="Omschrijving">
</telerik:GridBoundColumn>
</Columns>
<DetailTables>
<telerik:GridTableView AutoGenerateColumns="false" DataSourceID="SDS_PPB_DeliveryLines"
Width="100%" DataKeyNames="DelMainCode" ShowHeadersWhenNoRecords="false">
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="DelMainCode" MasterKeyField="DelMainCode" />
</ParentTableRelation>
<Columns>
<telerik:GridBoundColumn DataField="DelLineQty" HeaderText="Aant.">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="DelLineCompletedInd" HeaderText="Gereed">
</telerik:GridBoundColumn>
</Columns>
</telerik:GridTableView>
</DetailTables>
</telerik:GridTableView>
</DetailTables>
<DetailTables>
<telerik:GridTableView AutoGenerateColumns="false" DataSourceID="SDS_PPB_Invoices"
Width="100%" ShowHeadersWhenNoRecords="false">
<Columns>
<telerik:GridBoundColumn DataField="InstNr" HeaderText="Termijn">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="InstDescription" HeaderText="Omschrijving">
</telerik:GridBoundColumn>
</Columns>
</telerik:GridTableView>
</DetailTables>
</MasterTableView>
</telerik:RadGrid>
The second grid should generate the same template structure as the first one with weeknames as columns. The code for the second radgrid columns generation: This grid is added statically to the page.
Private Sub SetColumnHeaders_v2()
Dim Dt As DataTable = GetTimeTableWeeks_v2(PhaseId)
Dim TemplateColumn As GridTemplateColumn = Nothing
For Each dr As DataRow In Dt.Rows
TemplateColumn = New GridTemplateColumn
With TemplateColumn
.HeaderText = dr.Item(0).ToString.Trim
.HeaderStyle.Width = 20000
End With
RgMain.Columns.Add(TemplateColumn)
Next
End Sub
Please help.
René
I have a question about the radgrid control. The problem is that when I add templatecolumns to the grid from a datatable programmacally then columns aren't visible. The only way there are visible is when I connect de radgrid to an sqldatasource. But the when i click a link in the grid the complete grid vanishes.
Code for the first grid: this one binds fine although very slow but thats is another question.
<telerik:RadGrid ID="RgNav" runat="server" CellSpacing="0" DataSourceID="SDS_PPB_Project"
GridLines="None" Skin="Default" AutoGenerateColumns="false" CssClass="PpbNav">
<MasterTableView DataSourceID="SDS_PPB_Project" DataKeyNames="DossierCode" HeaderStyle-Height="48"
HierarchyDefaultExpanded="true">
<DetailTables>
<telerik:GridTableView AutoGenerateColumns="false" DataSourceID="SDS_PPB_Sales" Width="100%"
DataKeyNames="DetailCode,DetailSubCode" ShowHeadersWhenNoRecords="false" HierarchyDefaultExpanded="false">
<DetailTables>
<telerik:GridTableView DataSourceID="SDS_PPB_ProdDossiers" AutoGenerateColumns="false"
DataKeyNames="DetailCode,DetailSubCode,ProdHeaderDossierCode" HierarchyDefaultExpanded="false">
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="DetailCode" MasterKeyField="DetailCode" />
<telerik:GridRelationFields DetailKeyField="DetailSubCode" MasterKeyField="DetailSubCode" />
</ParentTableRelation>
<Columns>
<telerik:GridBoundColumn DataField="ProdHeaderDossierCode" HeaderText="ProdDossier">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ProdStatusCode" HeaderText="StatusCode">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="PhQty" HeaderText="Aantal">
</telerik:GridBoundColumn>
</Columns>
<DetailTables>
<telerik:GridTableView AutoGenerateColumns="false" DataSourceID="SDS_PPB_Operations"
Width="100%" DataKeyNames="ProdHeaderDossierCode" ShowHeadersWhenNoRecords="false"
HierarchyDefaultExpanded="false">
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="ProdHeaderDossierCode" MasterKeyField="ProdHeaderDossierCode" />
</ParentTableRelation>
<Columns>
<telerik:GridBoundColumn DataField="MachGrpCode" HeaderText="Bew.">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ProdBooStatusCode" HeaderText="StatusCode">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="MachPlanTime" HeaderText="Bew.PT">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="OperStartedInd" HeaderText="Gestart">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="OperFinishedInd" HeaderText="Gereed">
</telerik:GridBoundColumn>
</Columns>
</telerik:GridTableView>
</DetailTables>
</telerik:GridTableView>
</DetailTables>
<Columns>
<telerik:GridBoundColumn DataField="DetailCode" HeaderText="Vk.Rgl">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="DetailSubCode" HeaderText="SubRgl">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="DDDescription" HeaderText="Omschrijving">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="DDCalcQty" HeaderText="Aantal">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="DDCompletedInd" HeaderText="Gereed">
</telerik:GridBoundColumn>
</Columns>
<DetailTables>
<telerik:GridTableView AutoGenerateColumns="false" DataSourceID="SDS_PPB_Delivery"
Width="100%" DataKeyNames="DetailCode,DetailSubCode,DelMainCode" ShowHeadersWhenNoRecords="false"
HierarchyDefaultExpanded="false">
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="DetailCode" MasterKeyField="DetailCode" />
<telerik:GridRelationFields DetailKeyField="DetailSubCode" MasterKeyField="DetailSubCode" />
</ParentTableRelation>
<Columns>
<telerik:GridBoundColumn DataField="DelMainCode" HeaderText="HVS">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="DelDescription" HeaderText="Omschrijving">
</telerik:GridBoundColumn>
</Columns>
<DetailTables>
<telerik:GridTableView AutoGenerateColumns="false" DataSourceID="SDS_PPB_DeliveryLines"
Width="100%" DataKeyNames="DelMainCode" ShowHeadersWhenNoRecords="false" HierarchyDefaultExpanded="false">
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="DelMainCode" MasterKeyField="DelMainCode" />
</ParentTableRelation>
<Columns>
<telerik:GridBoundColumn DataField="DelLineQty" HeaderText="Aantal">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="DelLineCompletedInd" HeaderText="Gereed">
</telerik:GridBoundColumn>
</Columns>
</telerik:GridTableView>
</DetailTables>
</telerik:GridTableView>
</DetailTables>
</telerik:GridTableView>
</DetailTables>
<Columns>
<telerik:GridBoundColumn DataField="QuotNr" HeaderText="OfferteNr.">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="OrdNr" HeaderText="OrdNr.">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="DmDescription" HeaderText="Project">
</telerik:GridBoundColumn>
</Columns>
<DetailTables>
<telerik:GridTableView AutoGenerateColumns="false" DataSourceID="SDS_PPB_AllDelivery"
Width="100%" DataKeyNames="DelMainCode" ShowHeadersWhenNoRecords="false">
<Columns>
<telerik:GridBoundColumn DataField="DelMainCode" HeaderText="HVS">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="DelDescription" HeaderText="Omschrijving">
</telerik:GridBoundColumn>
</Columns>
<DetailTables>
<telerik:GridTableView AutoGenerateColumns="false" DataSourceID="SDS_PPB_DeliveryLines"
Width="100%" DataKeyNames="DelMainCode" ShowHeadersWhenNoRecords="false">
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="DelMainCode" MasterKeyField="DelMainCode" />
</ParentTableRelation>
<Columns>
<telerik:GridBoundColumn DataField="DelLineQty" HeaderText="Aant.">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="DelLineCompletedInd" HeaderText="Gereed">
</telerik:GridBoundColumn>
</Columns>
</telerik:GridTableView>
</DetailTables>
</telerik:GridTableView>
</DetailTables>
<DetailTables>
<telerik:GridTableView AutoGenerateColumns="false" DataSourceID="SDS_PPB_Invoices"
Width="100%" ShowHeadersWhenNoRecords="false">
<Columns>
<telerik:GridBoundColumn DataField="InstNr" HeaderText="Termijn">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="InstDescription" HeaderText="Omschrijving">
</telerik:GridBoundColumn>
</Columns>
</telerik:GridTableView>
</DetailTables>
</MasterTableView>
</telerik:RadGrid>
The second grid should generate the same template structure as the first one with weeknames as columns. The code for the second radgrid columns generation: This grid is added statically to the page.
Private Sub SetColumnHeaders_v2()
Dim Dt As DataTable = GetTimeTableWeeks_v2(PhaseId)
Dim TemplateColumn As GridTemplateColumn = Nothing
For Each dr As DataRow In Dt.Rows
TemplateColumn = New GridTemplateColumn
With TemplateColumn
.HeaderText = dr.Item(0).ToString.Trim
.HeaderStyle.Width = 20000
End With
RgMain.Columns.Add(TemplateColumn)
Next
End Sub
Please help.
René