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

Design Issue in radgrid while using Scrollbar for content

1 Answer 11 Views
Grid
This is a migrated thread and some comments may be shown as answers.
surya murthy
Top achievements
Rank 1
surya murthy asked on 12 May 2010, 06:12 PM

hi Telerik team,

In our Application, In grid we are using scroll for content ,
In this scenario, we are giving height for scroll option, because of this the grid height is not readjusting while "No Records are there" .

Here I'm attaching the screenshot of the page.please provide me solution for this.

 

Thanks in advance.

 

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 13 May 2010, 08:26 AM
Hi Surya,

Please avoid posting the same question in the forums and in a support ticket at the same time. If you do this, please notify at both places (or at least in the support ticket).


Now to your question. One option is to use the following approach:

http://www.telerik.com/help/aspnet-ajax/grdresizegridwithscrollingwhenlessdata.html

An alternative (server-side) approach is the following:

<%@ Page Language="VB" %>
<%@ Import Namespace="System.Data" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<script runat="server">
 
    Protected Sub RadGrid_NeedDataSource(ByVal sender As Object, ByVal e As GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource
        Dim dt As New DataTable()
        Dim dr As DataRow
        Dim cols As Integer = 4
        Dim rows As Integer = 0
        Dim colName As String = "Column"
     
        For c As Integer = 1 To cols
            dt.Columns.Add(String.Format("{0}{1}", colName, c))
        Next
     
        For r As Integer = 1 To rows
            dr = dt.NewRow()
            For rc As Integer = 1 To cols
                dr(String.Format("{0}{1}", colName, rc)) = String.Format("{0}{1} Row{2}", colName, rc, r)
            Next rc
            dt.Rows.Add(dr)
        Next r
 
        TryCast(sender, RadGrid).DataSource = dt
    End Sub
     
    Protected Sub RadGrid_PreRender(ByVal sender As Object, ByVal e As EventArgs) Handles RadGrid1.PreRender
        Dim grid As RadGrid = TryCast(sender, RadGrid)
        If grid.MasterTableView.Items.Count = 0 Then
            grid.CssClass = "NoRows"
            grid.Height = Unit.Empty
        End If
    End Sub
     
</script>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 
<head runat="server">
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<title>RadControls</title>
<style type="text/css">
 
.NoRows .rgDataDiv
{
    height: auto !important;
}
 
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
 
<telerik:RadGrid
    ID="RadGrid1"
    runat="server"
    Width="800px"
    Skin="Office2007">
    <ClientSettings>
        <Scrolling AllowScroll="true" UseStaticHeaders="true" />
    </ClientSettings>
</telerik:RadGrid>
 
</form>
</body>
</html>


Regards,
Dimo
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
surya murthy
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or