【问题标题】:asp.net DataGrid set fixed row heightasp.net DataGrid 设置固定行高
【发布时间】:2014-06-15 02:09:34
【问题描述】:

我有一个带有BoundColumnsDataGrid 控件。行是动态添加的。我如何保持行高固定,因为现在行高是根据列的内容生成的?

目前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>

【问题讨论】:

    标签: asp.net datagrid height row fixed


    【解决方案1】:

    这已通过在ItemStyle 中添加Wrap 属性并将值设置为False 来解决。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-08-04
      • 2013-12-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-30
      • 2010-11-13
      • 1970-01-01
      相关资源
      最近更新 更多