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

ServerOnDemand or ServerBind Not Working

3 Answers 77 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Lenny_shp
Top achievements
Rank 2
Lenny_shp asked on 10 Dec 2009, 10:53 PM
Tried 2009 Q3 Official and 2009.3.1201.35.
I am using declarative datasources.  
It works fine with HierarchyLoadMode="Client" but this is too slow prefetching all the child records since I have 2 lower levels.

When setting it to ServerOnDemand or ServerBind and I click on expand, it seems to go back to the server to do something (ajax loading template shows) but then nothing happens on the front-end.   Nothing is expanded.

I did NOT turn off EnableViewState on the grid.  
All connection strings for datasources to assigned in Page_Load.   Again this works with "Client" mode...   Help??

  <telerik:RadGrid EnableViewState="true" ID="RadGrid1" DataSourceID="srcMyWorklist" GridLines="None" runat="server"  
            AllowSorting="true" AllowFilteringByColumn="true"  
            AllowPaging="true" PageSize="20" AutoGenerateColumns="false" AllowAutomaticUpdates="False" Skin="Web20"  
            GroupingSettings-CaseSensitive="false" EnableLinqExpressions="false" 
            ShowGroupPanel="True" ShowHeader="true" ShowHeadersWhenNoRecords="true" AllowMultiRowEdit="false"
       
            <ClientSettings AllowColumnsReorder="True" AllowDragToGroup="True" ReorderColumnsOnClient="false"
                <Selecting AllowRowSelect="True" /> 
                <ClientEvents OnFilterMenuShowing="filterMenuShowing"  /> 
                <Scrolling AllowScroll="False" UseStaticHeaders="True" /> 
            </ClientSettings> 
             
            <FilterMenu OnClientShown="MenuShowing" ExpandAnimation-Type="None" CollapseAnimation-Type="None" /> 
             
            <MasterTableView DataKeyNames="ID"        
                NoDetailRecordsText="No records matching criteria" ShowHeadersWhenNoRecords="true"  
                AllowAutomaticUpdates="false" CommandItemDisplay="None">                           
 
                <PagerStyle Position="TopAndBottom" Mode="NextPrevNumericAndAdvanced" /> 
 
                <DetailTables> 
                    <telerik:GridTableView AutoGenerateColumns="false" HierarchyLoadMode="ServerOnDemand"    
                        DataSourceID="srcActivity" AllowMultiRowSelection="False" OverrideDataSourceControlSorting="true" 
                        runat="server" CommandItemDisplay="None" ShowStatusBar="False" AllowSorting="false" AllowFilteringByColumn="False"  
                       Name="grdActivity" DataKeyNames="ProcInstID,ActInstID" Width="50%" ShowHeadersWhenNoRecords="false" BackColor="Gainsboro"
                        <ParentTableRelation> 
                            <telerik:GridRelationFields DetailKeyField="ProcInstID" MasterKeyField="ID" /> 
                        </ParentTableRelation>     
 
                        <DetailTables> 
                            <telerik:GridTableView AutoGenerateColumns="false" HierarchyLoadMode="ServerOnDemand"  
                                DataSourceID="srcActivityDest" AllowMultiRowSelection="False" OverrideDataSourceControlSorting="true" 
                                runat="server" CommandItemDisplay="None" ShowStatusBar="False" AllowSorting="false" AllowFilteringByColumn="False"  
                                NoDetailRecordsText="N/A" DataKeyNames="ProcInstID,ActInstID" 
                                Name="grdActivityDest" Width="80%" ShowHeadersWhenNoRecords="true" BackColor="Gainsboro"
                                <ParentTableRelation> 
                                    <telerik:GridRelationFields DetailKeyField="ProcInstID" MasterKeyField="ProcInstID" /> 
                                    <telerik:GridRelationFields DetailKeyField="ActInstID" MasterKeyField="ActInstID" /> 
                                </ParentTableRelation>                         
                                <Columns> 
                                    <telerik:GridBoundColumn SortExpression="ProcInstID" HeaderText="ProcInstID" DataType="System.Int32" 
                                        DataField="ProcInstID" UniqueName="ProcInstID" ReadOnly="true" Display="false"
                                    </telerik:GridBoundColumn> 
 
                                    <telerik:GridBoundColumn SortExpression="ActInstID" HeaderText="ActInstID" DataType="System.Int32" 
                                        DataField="ActInstID" UniqueName="ActInstID" ReadOnly="true" Display="false"
                                    </telerik:GridBoundColumn>                                     
                                                         
                                    <telerik:GridBoundColumn SortExpression="User" HeaderText="User" DataType="System.String" 
                                        DataField="User" UniqueName="User" ReadOnly="true"
                                    </telerik:GridBoundColumn> 
                                                   
                                    <telerik:GridBoundColumn SortExpression="status" HeaderText="Status" DataType="System.String" ItemStyle-Width="60px" 
                                        DataField="status" UniqueName="status" ReadOnly="true"
                                    </telerik:GridBoundColumn>  
                                     
                                    <telerik:GridBoundColumn SortExpression="FinishDate" HeaderText="Finish By" DataType="System.DateTime" ItemStyle-Width="150px" 
                                        DataField="FinishDate" UniqueName="FinishDate" ReadOnly="true"
                                    </telerik:GridBoundColumn>                         
                                </Columns> 
                             </telerik:GridTableView> 
                        </DetailTables>              
                                                         
                        <Columns> 
                            <telerik:GridBoundColumn SortExpression="ProcInstID" HeaderText="ProcInstID" DataType="System.Int32" 
                                DataField="ProcInstID" UniqueName="ProcInstID" ReadOnly="true" Display="false"
                            </telerik:GridBoundColumn> 
 
                            <telerik:GridBoundColumn SortExpression="ActInstID" HeaderText="ActInstID" DataType="System.Int32" 
                                DataField="ActInstID" UniqueName="ActInstID" ReadOnly="true" Display="false"
                            </telerik:GridBoundColumn>                             
                                                 
                            <telerik:GridBoundColumn SortExpression="name" HeaderText="Activity" DataType="System.String" 
                                DataField="name" UniqueName="name" ReadOnly="true"
                            </telerik:GridBoundColumn> 
                                           
                            <telerik:GridBoundColumn SortExpression="status" HeaderText="Status" DataType="System.String" ItemStyle-Width="60px" 
                                DataField="status" UniqueName="status" ReadOnly="true"
                            </telerik:GridBoundColumn>  
 
                            <telerik:GridBoundColumn SortExpression="StartDate" HeaderText="Start At" DataType="System.DateTime" ItemStyle-Width="150px" 
                                DataField="StartDate" UniqueName="StartDate" ReadOnly="true"
                            </telerik:GridBoundColumn> 
                             
                            <telerik:GridBoundColumn SortExpression="FinishDate" HeaderText="Finish By" DataType="System.DateTime" ItemStyle-Width="150px" 
                                DataField="FinishDate" UniqueName="FinishDate" ReadOnly="true"
                            </telerik:GridBoundColumn>                         
                        </Columns> 
                     </telerik:GridTableView> 
                </DetailTables>    
                 
                                                                     
                <Columns>                                        
                    <telerik:GridHyperLinkColumn Target="_blank" DataNavigateUrlFields="ID,ProcID" AllowFiltering="false" ItemStyle-Width="30px" Display="false" 
                    Text="View" DataNavigateUrlFormatString="FormMgr.asp?ProcID={1}&ProcInstID={0}"
                    </telerik:GridHyperLinkColumn> 
 
                    <telerik:GridHyperLinkColumn Target="_blank" DataNavigateUrlFields="Data" AllowFiltering="false" ItemStyle-Width="30px" Display="true" 
                    Text="Open" NavigateUrl="{0}"
                    </telerik:GridHyperLinkColumn>                  
                                                             
                    <telerik:GridTemplateColumn UniqueName="Status" HeaderText="Status" DataField="Status" SortExpression="Status" 
                            EditFormColumnIndex="0" > 
                        <ItemTemplate>  
                            <asp:Label ID="lblStatus" runat="server" Text='<%# Bind("Status") %>'></asp:Label>  
                        </ItemTemplate> 
                        <FilterTemplate> 
                            <telerik:RadComboBox runat="server" ID="StatusFilter" Width="90px"  
                                DataSource='<%# (New string() {"", "Active", "Completed", "Error"}) %>' 
                                CollapseAnimation-Type="None" ExpandAnimation-Type="None" 
                                SelectedValue='<%# TryCast(Container,GridItem).OwnerTableView.GetColumn("Status").CurrentFilterValue %>' 
                                OnClientSelectedIndexChanged="StatusIndexChanged" >                  
                            </telerik:RadComboBox> 
                             
                            <telerik:RadScriptBlock ID="StatusScriptBlock" runat="server"
                                <script type="text/javascript"
                                    function StatusIndexChanged(sender, args) { 
                                        var tableView = $find("<%# TryCast(Container,GridItem).OwnerTableView.ClientID %>"); 
                                        tableView.filter("Status", args.get_item().get_value(), "EqualTo"); 
                                    } 
                                </script> 
                            </telerik:RadScriptBlock>                            
                        </FilterTemplate>       
                        <EditItemTemplate>                  
                           <asp:DropDownList ID="cboStatusType" runat="server" SelectedValue='<%# Bind("Status") %>' 
                                DataSource='<%# (New string() {"", "Active", "Completed", "Error" }) %>'  
                                Width="50px"
                           </asp:DropDownList>                                         
                        </EditItemTemplate>                                        
                    </telerik:GridTemplateColumn>                 
 
                    <telerik:GridBoundColumn HeaderText="Process" DataType="System.String"     
                        AutoPostBackOnFilter = "true" CurrentFilterFunction = "Contains" 
                        DataField="ProcessName" UniqueName="ProcessName" ItemStyle-Width="100px"
                    </telerik:GridBoundColumn> 
 
                    <telerik:GridBoundColumn HeaderText="Initiator" DataType="System.String"  
                        AutoPostBackOnFilter = "true" CurrentFilterFunction = "Contains"   
                        DataField="Originator" UniqueName="Initiator" ItemStyle-Width="90px"
                    </telerik:GridBoundColumn>                                   
                     
                    <telerik:GridBoundColumn HeaderText="Start Date" DataType="System.DateTime" DataFormatString="{0:MM/dd/yy}"  
                        CurrentFilterFunction = "GreaterThanOrEqualTo" AutoPostBackOnFilter = "true"  
                        DataField="StartDate" UniqueName="StartDate" ItemStyle-Width="50px"
                    </telerik:GridBoundColumn>                 
                                 
                    <telerik:GridBoundColumn HeaderText="Folio" DataType="System.String" HeaderStyle-HorizontalAlign="Center"  
                        AutoPostBackOnFilter = "true" CurrentFilterFunction = "Contains"   
                        DataField="Folio" UniqueName="Folio"
                    </telerik:GridBoundColumn>      
 
                    <telerik:GridBoundColumn HeaderText="ID" DataType="System.Int32"  
                        DataField="ID" UniqueName="ID" Display="false"
                    </telerik:GridBoundColumn>                              
                </Columns> 
 
                <RowIndicatorColumn Visible="true"
                <HeaderStyle Width="10px"></HeaderStyle> 
                </RowIndicatorColumn>                        
             
            </MasterTableView> 
 
        </telerik:RadGrid> 

3 Answers, 1 is accepted

Sort by
0
Lenny_shp
Top achievements
Rank 2
answered on 11 Dec 2009, 06:41 PM
When I commented out this code the 1st level is now expanding with ServerOnDemand, but 2nd level isn't working --- it closes the 1st level.

   Private Sub RadGrid1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadGrid1.PreRender
        'RadGrid1.Rebind()   'needed, or else ItemDataBound does not fire
    End Sub
0
Lenny_shp
Top achievements
Rank 2
answered on 14 Dec 2009, 03:39 PM
I am still having trouble with this.  Can someone point out what could be wrong?

With 2 levels it is working, but not with 3 levels.
0
Tsvetoslav
Telerik team
answered on 16 Dec 2009, 12:25 PM
Hi Leonid,

Your mark-up seems all right and, going by your second post, evidently there is something wrong with your code behind. I'd ask you to open up a formal support ticket and send us a fully runnable implementation of your project along with a back-up copy of the database. This will facilitate us to a great extent with pinpointing the issue and will guarantee you a faster response on our part. If you prefer to write on the forum, could you at least post your code-behind for the page.

Thanks.
 
All the best,
Tsvetoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Lenny_shp
Top achievements
Rank 2
Answers by
Lenny_shp
Top achievements
Rank 2
Tsvetoslav
Telerik team
Share this question
or