开发者

Printing long text from asp.net gridview

I have a asp.net gridview on a page. Since one of the columns is very long, I cut the text and display it in a tooltip.

When printing I make sure the whole text ge开发者_StackOverflow社区ts displayed.

The problem is that this columns is printed as a long column, which is a big waste of paper.

How could I get to print across in a nice way?

Naphtali


I use a different control to display a short text string as opposed to a longer text string. This technique may be able to be used in your situation and of course it can be expanded as well.

  <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.

Hope this helps

Harvey Sather

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜