我在页面上有一个asp.net gridview。由于其中一列非常长,我剪切文本并将其显示在工具提示中
打印时我确保显示整个文本
问题是这些柱子被打印成长柱,这是纸张的一大浪费
我怎么能以一种很好的方式打印出来?
纳斐塔
答案 0 :(得分:0)
我使用不同的控件来显示短文本字符串而不是更长的文本字符串。 这种技术可以在你的情况下使用,当然也可以扩展。
<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.
希望这有帮助
哈维萨瑟