Word wrap in textbox of DetailsView

Discussion in 'ASP .Net' started by Jason, May 15, 2006.

  1. Jason

    Jason Guest

    Anyone know how to make the text wrap in a text box of a DetailsView?
     
    Jason, May 15, 2006
    #1
    1. Advertising

  2. Jason

    PeterKellner Guest

    "Jason" <> wrote in message
    news:...
    > 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
     
    PeterKellner, May 15, 2006
    #2
    1. Advertising

  3. Jason

    Jason Guest

    That worked! Thanks!
     
    Jason, May 15, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jason Coyne  Gaijin42

    Word wrap line break code and algorithm for c#

    Jason Coyne Gaijin42, Apr 8, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    24,329
    Jason Coyne Gaijin42
    Apr 8, 2004
  2. Aaron Fude

    To wrap or not to wrap?

    Aaron Fude, May 8, 2008, in forum: Java
    Replies:
    12
    Views:
    724
    Chronic Philharmonic
    May 10, 2008
  3. Feege
    Replies:
    0
    Views:
    493
    Feege
    Dec 20, 2005
  4. Art Werschulz

    Text::Wrap::wrap difference

    Art Werschulz, Sep 22, 2003, in forum: Perl Misc
    Replies:
    0
    Views:
    258
    Art Werschulz
    Sep 22, 2003
  5. Art Werschulz

    Text::Wrap::wrap difference

    Art Werschulz, Sep 24, 2003, in forum: Perl Misc
    Replies:
    1
    Views:
    262
    Anno Siegel
    Sep 25, 2003
Loading...

Share This Page