Word wrap in textbox of DetailsView

P

PeterKellner

Jason said:
Anyone know how to make the text wrap in a text box of a DetailsView?

Convert the field to a templated, then in the textbox and set wrap="true".
You might also want to use the multi-line textbox attribute. Here is some
example code.

<asp:DetailsView ID="DetailsView1" runat="server"
DataSourceID="SqlDataSource1" Height="50px"

Width="125px" AutoGenerateRows="False" AllowPaging="True">

<Fields>

<asp:CommandField ShowEditButton="True" />

<asp:TemplateField HeaderText="FirstName" SortExpression="FirstName">

<EditItemTemplate>

<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("FirstName")
%>'></asp:TextBox>

</EditItemTemplate>

<InsertItemTemplate>

<asp:TextBox ID="TextBox1" Wrap="true" runat="server" Text='<%#
Bind("FirstName") %>'></asp:TextBox>

</InsertItemTemplate>

<ItemTemplate>

<asp:Label ID="Label1" runat="server" Text='<%# Bind("FirstName")
%>'></asp:Label>

</ItemTemplate>

</asp:TemplateField>

<asp:BoundField DataField="Id" HeaderText="Id" InsertVisible="False"
ReadOnly="True"

SortExpression="Id" />

</Fields>

</asp:DetailsView>



Peter Kellner

http://peterkellner.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top