asp.net Grid - 如何在编辑模式下包装文本

时间:2016-07-01 09:41:40

标签: asp.net gridview edit

我正在网格中显示数据(包裹)但是当我点击编辑按钮时没有显示完整的数据,因为文本框非常小(数据未包装)。任何帮助请...

image is showing the two states(edit and normal)

示例代码行:

<asp:TemplateField HeaderText="Reason(NotDone)" SortExpression="tReason">
      <EditItemTemplate>
         <asp:TextBox ID="TextBox9" runat="server" Text='<%# Bind("tReason") %>'>
         </asp:TextBox>
      </EditItemTemplate>
      <ItemTemplate>
          <asp:Label ID="Label17" runat="server" Text='<%# Bind("tReason") %>' ></asp:Label>
      </ItemTemplate>
      <HeaderStyle BackColor="SeaGreen" />
</asp:TemplateField>

........ 在页面加载时,我使用以下代码:

GridView1.Attributes.Add("style", "word-break:break-all; word-wrap:break-word");

2 个答案:

答案 0 :(得分:0)

使文本框成为多行。

<asp:TextBox ID="TextBox9" runat="server" Text='<%# Bind("tReason") %>' 
TextMode="MultiLine"></asp:TextBox>

答案 1 :(得分:0)

谢谢Akash&amp;迈克尔的快速反应......我已经这样做了,它正在网格中.....请建议如果它是正确的方式........ asp:TemplateField HeaderText =“Reason(如果没有完成)“SortExpression =”tReason“&gt;                                                      'TextMode =“Multiline”Rows =“10”&gt;                                                                               '&gt;                                                                       

相关问题