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

Grid / Hierarchy with NestedViewTemplate

1 Answer 57 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Malichone
Top achievements
Rank 1
Malichone asked on 15 Apr 2010, 03:11 PM
What I am trying to accomplish is have a master grid view that shows the workgroups the user is a member of. when the workgroup is expanded the assigned tickets to that workgroup will be displayed. The catch is i want the RadGrid inside of the NestedViewTemplate to have a maxHeight property and an overflow to allow scrolling. I do not want to use paging as the result set will ever only be in the 10s of records.
The error that I am getting is "Could not find control 'lblWorkgroupID' in ControlParameter'TO_WORKGROUP_FROM_SQL2'."
And the markup is:
                            <asp:SqlDataSource  
                                ID="SqlDataSource1"  
                                runat="server"  
                                ConnectionString="<%$ ConnectionStrings:ConnectionString %>"  
                                ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" /> 
                            <asp:SqlDataSource  
                                ID="SqlDataSource2"  
                                runat="server"  
                                ConnectionString="<%$ ConnectionStrings:ConnectionString %>"  
                                ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" > 
                                <SelectParameters> 
                                    <asp:ControlParameter ControlID="lblWorkgroupID" PropertyName="Text" Type="String" Name="TO_WORKGROUP_FROM_SQL2" /> 
                                </SelectParameters> 
                            </asp:SqlDataSource> 
                            <telerik:radgrid id="RadGrid_Incidents" AutoGenerateColumns="false" ShowHeader="false" runat="server" DataSourceID="SqlDataSource1" Skin="Default"
                                <MasterTableView ClientDataKeyNames="TO_WORKGROUP_FROM_SQL2" DataKeyNames="TO_WORKGROUP_FROM_SQL1" HierarchyLoadMode="Client"
                                    <Columns> 
                                        <telerik:GridBoundColumn UniqueName="TO_WORKGROUP" DataField="TO_WORKGROUP_FROM_SQL1" /> 
                                    </Columns> 
                                    <NestedViewSettings DataSourceID="SqlDataSource2"
                                        <ParentTableRelation> 
                                            <telerik:GridRelationFields DetailKeyField="TO_WORKGROUP_FROM_SQL2" MasterKeyField="TO_WORKGROUP_FROM_SQL1" /> 
                                        </ParentTableRelation> 
                                    </NestedViewSettings> 
                                    <NestedViewTemplate> 
                                    <div style="max-height:100px; overflow:auto"
                                        <asp:Label ID="lblWorkgroupID" Text='<%# Eval("TO_WORKGROUP_FROM_SQL1") %>' Visible="false" runat="server" /> 
                                            <telerik:radgrid AutoGenerateColumns="false" id="Incidents_Grid" ShowHeader="false" runat="server" DataSourceID="SqlDataSource2" Skin="Default"
                                                <MasterTableView DataKeyNames="TO_WORKGROUP_FROM_SQL2" HierarchyLoadMode="Client"
                                                   <Columns> 
                                                       <telerik:GridBoundColumn UniqueName="DESCRIPTION" HeaderText="DESCRIPTION" DataField="DESCRIPTION" /> 
                                                       <telerik:GridBoundColumn UniqueName="INCIDENT_ID" HeaderText="INCIDENT_ID" DataField="INCIDENT_ID" ItemStyle-Font-Size="8pt" /> 
                                                   </Columns> 
                                                </MasterTableView> 
                                            </telerik:radgrid> 
                                        </div> 
                                    </NestedViewTemplate> 
                                    <ExpandCollapseColumn Visible="True" /> 
                                </MasterTableView> 
                                <ClientSettings Selecting-AllowRowSelect="true" /> 
                            </telerik:radgrid> 

with codebehind:
                String _User = "longjt";//HttpContext.Current.Request.ServerVariables["AUTH_USER"]; 
 
                SqlDataSource1.SelectCommand = "SELECT NAME as TO_WORKGROUP_FROM_SQL1 FROM SERVICE_MANAGER_ADM.ASSIGNMENTA1 WHERE OPERATORS = '" + _User + "'"
                SqlDataSource2.SelectCommand = "SELECT TO_WORKGROUP as TO_WORKGROUP_FROM_SQL2, TO_PERSON_VUNETID, DESCRIPTION, INCIDENT_ID,  CREATED_ON FROM SERVICE_MANAGER_ADM.INCIDENT_REPORT_VIEW WHERE   (TO_WORKGROUP = @TO_WORKGROUP) AND STATUS != 'Closed' AND STATUS != 'Resolved' ORDER By TO_PERSON_VUNETID, CREATED_ON"
 


1 Answer, 1 is accepted

Sort by
0
Malichone
Top achievements
Rank 1
answered on 16 Apr 2010, 04:12 PM
Solved this with the following code:

                             <telerik:RadGrid ID="RadGrid_Incidents" DataSourceID="SqlDataSource1" runat="server" AutoGenerateColumns="False"
                                <MasterTableView DataSourceID="SqlDataSource1" DataKeyNames="TO_WORKGROUP" GroupLoadMode="Server"
                                    <NestedViewTemplate> 
                                        <asp:SqlDataSource ID="Incidents_Grid_DataSource" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                                            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" runat="server" 
                                            SelectCommand="SELECT TO_WORKGROUP, TO_PERSON_VUNETID, DESCRIPTION, INCIDENT_ID, CREATED_ON FROM SERVICE_MANAGER_ADM.INCIDENT_REPORT_VIEW WHERE (&quot;TO_WORKGROUP&quot;= :TO_WORKGROUP) AND STATUS != 'Closed' AND STATUS != 'Resolved' ORDER By TO_PERSON_VUNETID, CREATED_ON"
                                            <SelectParameters> 
                                                <asp:ControlParameter ControlID="lblWorkgroupID" PropertyName="Text" Type="String" Name="TO_WORKGROUP" /> 
                                            </SelectParameters> 
                                        </asp:SqlDataSource> 
                                        <div style="max-height:100px; overflow:auto"
                                            <asp:Label ID="lblWorkgroupID" Font-Bold="true" Font-Italic="true" Text='<%# Eval("TO_WORKGROUP") %>' Visible="false" runat="server" /> 
                                            <telerik:RadGrid runat="server" ID="Incidents_Grid" ShowHeader="false" DataSourceID="Incidents_Grid_DataSource"
                                                <MasterTableView AutoGenerateColumns="False" DataKeyNames="TO_WORKGROUP" HierarchyLoadMode="ServerOnDemand"
                                                    <Columns> 
                                                       <telerik:GridBoundColumn UniqueName="DESCRIPTION" DataField="DESCRIPTION" /> 
                                                       <telerik:GridBoundColumn UniqueName="INCIDENT_ID" DataField="INCIDENT_ID" ItemStyle-Font-Size="8pt" /> 
                                                    </Columns> 
                                                </MasterTableView> 
                                            </telerik:RadGrid> 
                                        </div> 
                                    </NestedViewTemplate> 
                                    <Columns> 
                                        <telerik:GridBoundColumn UniqueName="TO_WORKGROUP" DataField="TO_WORKGROUP" /> 
                                        <telerik:GridBoundColumn UniqueName="INCIDENTCOUNT" DataField="INCIDENTCOUNT" /> 
                                    </Columns> 
                                </MasterTableView> 
                            </telerik:RadGrid> 
                            <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" /> 
 

Tags
Grid
Asked by
Malichone
Top achievements
Rank 1
Answers by
Malichone
Top achievements
Rank 1
Share this question
or