【问题标题】:GRIDVIEW not shoing complete text in cells in ASP.NET VB.NETGRIDVIEW 未在 ASP.NET VB.NET 的单元格中显示完整的文本
【发布时间】:2015-03-24 19:16:08
【问题描述】:

我正在使用 gridview 从 ASP.NET 中的 MSSQL 获取数据。数据成功来了。只有其中包含 HTML 且文本较长的两列未正确显示。每个单元格在 33 个字符后结束。 我正在获取数据并将其放入 LABEL。 gridview里面的代码如下

<asp:GridView ID="GridView1" runat="server" Width="100%"
            Font-Names="Arial" Font-Size="Small" 
            AllowSorting="True" AutoGenerateColumns="False" 
            DataKeyNames="IDLessonLearnt" CellPadding="3" CellSpacing="3"
            DataSourceID="SqlDataSource1" PageSize="25" ShowFooter="True">
            <HeaderStyle ForeColor="White" Font-Bold="True" 
          BackColor="#25a0da" Font-Names="Arial" Font-Size="14px" Height="30px"></HeaderStyle>

            <Columns>

<asp:TemplateField ItemStyle-Width="600px" HeaderText="LESSONS / ISSUES" ItemStyle-HorizontalAlign="left">
 <ItemTemplate>
 <asp:Label ID="LessonLearned" runat="server" Text ='<%# System.Web.HttpUtility.HtmlEncode(Eval("LessonsIssues"))%>' ></asp:Label>
 </ItemTemplate>
 <ItemStyle Wrap="true" Width="600" />
 <HeaderTemplate>
 <asp:TextBox ID="txtLessonLearned" runat="server" onkeyup="filter_LessonLearned(this)" CssClass="texbox_header" 
                    Width="590px" placeholder="LESSONS / ISSUES" Text="">  </asp:TextBox>
    </HeaderTemplate>
    <ItemStyle HorizontalAlign="left" Width="600px" />
    </asp:TemplateField>

</Columns>
</asp:GridView>

我没有使用任何编程这个 Gridview 和数据源在 .aspx 文件中。所有数据都很好,即使数据库中的 html 代码正在被解析,但它只显示单元格的 33 个字符。

有什么限制吗?任何建议。

提前谢谢

【问题讨论】:

  • 数据库中HTML列的数据类型是什么?

标签: asp.net gridview templatefield


【解决方案1】:

我发现该表有 varchar(max) 但我使用的存储过程的列长度为 200,这是由另一个开发人员开发的。我改成9000,现在可以了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-06
    • 2010-11-02
    • 2013-01-14
    • 1970-01-01
    • 2013-04-09
    相关资源
    最近更新 更多