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

Grid Border Position Incorrect

1 Answer 31 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
ADe asked on 29 Sep 2010, 12:49 PM

   We are experiencing a problem with the RadGrid. This happens when the width of the grid is larger than the browser window. The right border does not appear at the right edge of the grid but rather at the right side of the browser window.

   I have attached images which shows the issue. I have a project that demonstrates this but can't seem to attach a zip file.

   Here is the aspx,

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<head runat="server">
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
<telerik:RadGrid ID="RadGrid1" runat="server">
<HeaderStyle Width="20px"></HeaderStyle>
<HeaderStyle Width="20px"></HeaderStyle>

   Here is the code to populate the grid,

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
public partial class _Default : System.Web.UI.Page 
    protected void Page_Load(object sender, EventArgs e)
        DataTable dt = new DataTable();
        for (int i=1; i<=20; i++)
            dt.Columns.Add("Column" + i);
        for (int i = 1; i <= 10; i++)
            DataRow r = dt.NewRow();
            for (int j = 0; j <= 19; j++)
                r[j] = "Value";
        RadGrid1.DataSource = dt;

   I seem to be able to get around this on our real site by using a custom skin and any font other than vedana but this is obviously not ideal as it is inconsistant with our website's theme.


1 Answer, 1 is accepted

Sort by
Telerik team
answered on 29 Sep 2010, 01:15 PM
Hello ADe,

The RadGrid control is a <div> element with a <table> element inside. <div>s are by defautl 100% wide and do not expand to enclose their content, while tables do expand. So the observed behavior is expected.

This issue is fixed in the latest official version of RadControls with some Javascript, so you can upgrade to avoid it.

Alternatively, you can use on of the following workarounds:

1) set a large-enough pixel width to the RadGrid control - this is the workaround we are using internally, if we detect that the MasterTableView is wider than the control's wrapper

2) remove the outer RadGrid border with <telerik:RadGrid  style="border:0"  />

3) float the RadGrid control and clear the float after it with:

<telerik:RadGrid  style="float:left"  />
<div style="clear:both"><!-- --></div>

(floated elements expand as much as necessary to enclose their content)

Best wishes,
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
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question