我的gridview遇到了麻烦,它在容器上重叠,
这是我的datagridview代码:
<asp:GridView ID="gvData" runat="server" AllowPaging="True" AutoGenerateColumns="False"
CellPadding="4" DataKeyNames="PayId" Font-Size="11px" ForeColor="Black" PageSize="20"
Width="100%" BorderColor="Black" CssClass="zebra" AlternatingRowStyle-CssClass="even" >
当我生成行时,在datagridvie绑定上,我使用:
Protected Sub gvData_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvData.RowDataBound
For i As Integer = 0 To e.Row.Cells.Count - 1
e.Row.Cells(i).Attributes.Add("style", "white-space:nowrap;")
Next
End Sub
对于我已经在母版页上设置em的容器,使用css类:
for wholoe page:
#PublicWrapper.width100 {
width: 92%;
padding-left: 2%;
padding-right: 2%;
float:left;
left: 50%;
position:relative;
margin-left: -48%;
}
身体:
body.modern{
background-image: url(../Images/);
font-family: Arial;
color: rgb(0, 0, 0);
background-color: #353f5b;
line-height: normal;
font-size: 12px;
background-position: 0% 0%;
background-repeat: repeat;
background-attachment: scroll;
padding: 0px;
margin-top: 0px;
margin-left: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
和网格容器:
body #PublicWrapper .placeholder_5.sf_cols {
background-color: #a2a2a2;
}
我已添加display: inline-block;
但容器和正文未显示在中心屏幕上,但我的问题已解决。我应该使用css上的任何技巧使身体适合中心屏幕,但网格是否重叠?
答案 0 :(得分:0)
不要在宽度中使用百分比,请使用像素大小
可以将Width="100%"
更改为Width="1000px"