我有一个DataGrid
控件BoundColumns
。行是动态添加的。如何保持行高度固定,现在根据列的内容生成行高?
目前DataGrid
正在溢出。我试图限制行的高度,但找不到解决方案。无论内容的长度如何,我都需要行具有固定的高度。
<asp:DataGrid ID="DataGrid1" runat="server"
AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
BackColor="White" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px"
CellPadding="3" Font-Size="XX-Small"
OnItemCommand="DataGrid1_ItemCommand" Width="720px"
OnPageIndexChanged="DataGrid1_PageIndexChanged" TabIndex="-1" >
<FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
<SelectedItemStyle BackColor="#738A9C" ForeColor="#F7F7F7" />
<AlternatingItemStyle BackColor="#F7F7F7" />
<ItemStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" Width="712px"/>
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" Font-Size="XX-Small" ForeColor="#F7F7F7" Width="712px"/>
<Columns>
<asp:ButtonColumn CommandName="show" DataTextField="TASK_ID" HeaderText="Ticket No."><ItemStyle Width="60px"/></asp:ButtonColumn>
<asp:BoundColumn DataField="AGENT_ID" HeaderText="Agent"><ItemStyle Width="120px"/></asp:BoundColumn>
<asp:BoundColumn DataField="TASK_DESCRIPTION" HeaderText="Task Description"><ItemStyle Width="300px" CssClass="colStyle"/></asp:BoundColumn>
<asp:BoundColumn DataField="TASK_ASSIGNED_DATE" HeaderText="Job Date"><ItemStyle Width="60px"/></asp:BoundColumn>
<asp:BoundColumn DataField="TASK_EXPECTED_DATE" HeaderText="Expected Date"><ItemStyle Width="80px"/></asp:BoundColumn>
<asp:BoundColumn DataField="TASK_COMPLETED_DATE" HeaderText="Completed Date"><ItemStyle Width="100px"/></asp:BoundColumn>
<asp:BoundColumn DataField="TASK_STATUS" HeaderText="Status"><ItemStyle Width="40px"/></asp:BoundColumn>
<asp:BoundColumn DataField="TASK_ID" Visible="false"></asp:BoundColumn>
</Columns>
<PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" Mode="NumericPages" /></asp:DataGrid>
答案 0 :(得分:0)
这已通过在Wrap
中添加ItemStyle
属性并将值设置为False
来解决。