使用发布的示例 here ,我一切正常。问题是风格。当 gridview 加载时,它看起来很棒。我按编辑,字体、列高、宽度等都改变了。如何在按下“编辑”按钮时编辑样式,使其在加载时看起来与之前的样式完全一样?
<asp:GridView ID="GridView1" runat="server" DataKeyNames="CustomerId" OnRowDataBound="OnRowDataBound" OnRowEditing="OnRowEditing" OnRowCancelingEdit="OnRowCancelingEdit" OnRowUpdating="OnRowUpdating" OnRowDeleting="OnRowDeleting" EmptyDataText="No records has been added." AutoGenerateEditButton="true" AutoGenerateDeleteButton="true">
</asp:GridView>
最佳答案
您可以使用 gridview 本身:
<asp:GridView ID="GridView1" runat="server">
<EditRowStyle BackColor="Green" />
</asp:GridView>
将 gridview 与样式表一起使用:
<asp:GridView ID="GridView1" runat="server">
<EditRowStyle CssClass="myClass" />
</asp:GridView>
或使用样式表:
#GridView1 input { width: 100%; }
关于css - ASP 编辑 GridView 样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47319204/