【问题标题】:Printing long text from asp.net gridview从 asp.net gridview 打印长文本
【发布时间】:2011-05-30 16:40:25
【问题描述】:


我在页面上有一个 asp.net gridview。由于其中一列很长,我剪切了文本并将其显示在工具提示中。
打印时,我确保显示整个文本。
问题是这列打印成一列很长,浪费了很大的纸张。
我怎样才能以一种好的方式打印出来?

石脑油

【问题讨论】:

    标签: asp.net gridview printing


    【解决方案1】:

    我使用不同的控件来显示一个短文本字符串,而不是一个较长的文本字符串。 这种技术也许可以在您的情况下使用,当然也可以扩展。

      <ItemTemplate>
          <asp:Label ID="lblInspectionNotes" runat="server" Text='<%# Eval("IH_Notes") %>' Visible='<%#  evalLength(Eval("IH_Notes")) %>' ></asp:Label>
          <asp:TextBox ID="txtInspectionNotes" runat="server" Text='<%# Eval("IH_Notes") %>' Visible='<%#  evalLength2(Eval("IH_Notes")) %>' Rows="3" TextMode="MultiLine" ReadOnly="true"></asp:TextBox>
      </ItemTemplate>
    
    the function evalLength returns true if the length of the text is less than or equal to 20 characters otherwise it returns false.
    the function evalLength2 returns true if the length of the text is greater than 20 characters otherwise it returns false.
    
    this results in only one of the controls being displayed.
    A single line label is displayed if the text is 20 characters or less.
    A multiline textbox is displayed if the text is more than 20 characters
    
    Then your printing will display differently as well.
    I do not know how you are printing your gridview, but this technique may help you.
    

    希望对你有帮助

    哈维·萨瑟

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-08
      • 1970-01-01
      • 2011-04-13
      相关资源
      最近更新 更多