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

[Solved] RadGrid & DetailTable generate empty row

5 Answers 297 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ti
Top achievements
Rank 1
Ti asked on 18 Jun 2008, 12:07 PM

Hi there!
I have a problem with the RadGrid (Prometheus) and an including DetailTable.
Both are filled correctly, but when I set RadGrid PageSize to "10" (for example), RadGrid displays 10 "datafilled" rows and one empty row on the bottom. The same problem with the DetailTables...

I compare Code with Telerik OnlineDemos, but can not find the reason, why... Can u help?!
Thanks a lot and sry for my broken english ;)

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 18 Jun 2008, 12:16 PM
Hi Ti,

Have you set the ShowFooter property to true? Try setting it to false in the aspx as shown below.

ASPX:
 <telerik:radgrid id="RadGrid1" runat="server"   ShowFooter="False"   AllowPaging="True"     PageSize="5"  datasourceid="SqlDataSource2"  gridlines="Both"  > 


Thanks
Shinu.
0
Ti
Top achievements
Rank 1
answered on 18 Jun 2008, 12:32 PM
Hey Shinu!
ShowFooter-Property is already set to "false". This row doesn't look like a footer-row, but like a row without data... ^^

Code is trivial, but I post for better understanding:

<telerik:RadGrid ID="grid1" runat="server" AutoGenerateEditColumn="false" PageSize="10" AllowPaging="True" 
ShowStatusBar="true" AutoGenerateColumns="false" AutoGenerateDeleteColumn="false" GridLines="Both" Skin="Default2006"   
AllowSorting="true" DataSourceID="ls" ShowFooter="False">  
 
<MasterTableView DataKeyNames="ID" NoMasterRecordsText="- nothing found -" HierarchyLoadMode="Client"   
HierarchyDefaultExpanded="false">  
                          
<Columns> 
   <telerik:GridBoundColumn DataField="ID" UniqueName="ID" 
     SortExpression="ID" Visible="false" AllowSorting="true">  
   </telerik:GridBoundColumn> 
   <telerik:GridButtonColumn UniqueName="Nr" HeaderText="Nr." CommandName="GotoPage1"   
     DataTextField="Nr" SortExpression="Nr">  
 </telerik:GridButtonColumn> 
</Columns> 
         
 
                   
                          
<DetailTables> 
  <telerik:GridTableView Width="100%" AllowMultiColumnSorting="True" runat="server"   
   DataKeyNames="ID" NoDetailRecordsText="- nothing found here -" AllowPaging="false">  
    
 <ParentTableRelation> 
     <telerik:GridRelationFields DetailKeyField="ID" MasterKeyField="ID" /> 
   </ParentTableRelation> 
 
       <Columns> 
         <telerik:GridBoundColumn AllowSorting="true" DataField="ID" SortExpression="ID" 
         UniqueName="ID" Visible="false">  
       </telerik:GridBoundColumn> 
       <telerik:GridBoundColumn AllowSorting="true" DataField="Name" SortExpression="Name" 
         UniqueName="Name" Visible="true">  
       </telerik:GridBoundColumn> 
                                      
        </Columns>                                       
   </telerik:GridTableView> 
</DetailTables> 
                          
 
</MasterTableView> 
</telerik:RadGrid> 
 
 
 
 
<asp:SqlDataSource ID="ls" runat="server" SelectCommand="SELECT * FROM queryData"    
        ConnectionString="<%$ ConnectionStrings:LocalSqlServer %>" ProviderName="<%$ ConnectionStrings:LocalSqlServer.ProviderName %>">  
</asp:SqlDataSource> 
 
<asp:SqlDataSource ID="lspos" runat="server" SelectCommand="Select * from queryData2 where ID=@ID" 
ConnectionString="<%$ ConnectionStrings:LocalSqlServer %>" ProviderName="<%$ ConnectionStrings:LocalSqlServer.ProviderName %>">  
<SelectParameters> 
     <asp:SessionParameter Name="ID" SessionField="ID" Type="Int32" /> 
</SelectParameters> 
</asp:SqlDataSource> 
 

-= Ti =-
0
Ti
Top achievements
Rank 1
answered on 18 Jun 2008, 01:45 PM
*** Problem sloved ***

Ups, my fault! Cause I have a RadComBox to find data, I forgot to rebind the Grid (and DetailTables) after the ls.selectCommand...

Now everthing is OK! ;)=
-= Ti =-
0
Madhavi
Top achievements
Rank 1
answered on 07 Aug 2013, 11:54 AM
How to generate Empty  row in detail table. click on my (image button) i need to save  data into data base..

 I  have three  Controls text box,  drop down, Multiline text box.
 I need to bind  detail table control before expand Plus Icon  in hierarchical grid..
 what is exact event to bind detail table Controls..

any one please help me how to bind.. thanks in advance..

detail table databind..Code
     protected void rdCommentLog_DetailTableDataBind(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)
        {
            GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem;
            //switch (e.DetailTableView.Name)
            switch (dataItem.GetDataKeyValue("CategoryTypecode").ToString().Trim())
            {
                case "1":
                    {
                        //  int ID = Convert.ToInt32(dataItem.GetDataKeyValue("ID").ToString());
                        List<ProjectCommentLogInfo> lstProjectCommnetLog = new List<ProjectCommentLogInfo>();
                        lstProjectCommnetLog = projectService.LoadProjectCommentLogDetailsData().ToList();
                        e.DetailTableView.DataSource = lstProjectCommnetLog;
                        //rdCommentLog.DataBind();
                        break;
                    }

            }



Master Table Data Bind


 protected void rdCommentLog_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            List<ProjectCommentLogInfo> lstProjectCommnetLog = new List<ProjectCommentLogInfo>();
            lstProjectCommnetLog = projectService.LoadProjectCommentLog().ToList();

            //lstProjectCommnetLog = projectService.LoadProjectCommentLogDetailsData().ToList();
            rdCommentLog.DataSource = lstProjectCommnetLog;
        }

0
Eyup
Telerik team
answered on 12 Aug 2013, 07:13 AM
Hello Madhavi,

Here is a practical demonstration of the requested functionality:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/detailtabledatabind/defaultcs.aspx

Hope this helps.

Regards,
Eyup
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
Ti
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Ti
Top achievements
Rank 1
Madhavi
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or