There's far more too do then that link, of which most important is to give same width to the enclosing DIV as that of GridView
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.rounded-corners
{
border: 1px solid #A1DCF2;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
overflow: hidden;
}
.Grid td,.Grid th
{
border:1px solid #A1DCF2
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div class = "rounded-corners" style = "width:300px">
<asp:GridView ID="GridView1" CssClass = "Grid" runat="server" Width = "300" HeaderStyle-BackColor="#3AC0F2" HeaderStyle-ForeColor="White"
RowStyle-BackColor="#A1DCF2" AlternatingRowStyle-BackColor="White" AutoGenerateColumns = "false">
<Columns>
<asp:BoundField DataField = "Name" HeaderText = "Name" />
<asp:BoundField DataField = "Country" HeaderText = "Country" />
</Columns>
</asp:GridView>
</div>
</form>
</body>
</html>
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[2] { new DataColumn("Name"), new DataColumn("Country") });
dt.Rows.Add("John Hammond", "Canada");
dt.Rows.Add("Rick Stewards", "United States");
dt.Rows.Add("Huang He", "China");
dt.Rows.Add("Robert Williams", "England");
GridView1.DataSource = dt;
GridView1.DataBind();
}
}
