protected override void Render(HtmlTextWriter writer) { // 给GridView一个容器 <div> if (!TableWidth.IsEmpty || !TableHeight.IsEmpty) { if (TableWidth.IsEmpty) { TableWidth = new Unit(100, UnitType.Percentage); } if (TableHeight.IsEmpty) { TableHeight = new Unit(100, UnitType.Percentage); } writer.Write("<div id='yy_ScrollDiv' style=\"overflow: auto; width: " + TableWidth.ToString() + "; height: " + TableHeight.ToString() + "; position: relative;\" "); writer.Write(">"); } base.Render(writer); // </div> 结束 if (!TableWidth.IsEmpty || !TableHeight.IsEmpty) { writer.Write("</div>"); } }