470,573 Members | 1,761 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,573 developers. It's quick & easy.

Word wrap in textbox of DetailsView

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

May 15 '06 #1
3 14342

"Jason" <ja*************@hotmail.com> wrote in message
news:11**********************@y43g2000cwc.googlegr oups.com...
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


May 15 '06 #2
That worked! Thanks!

May 15 '06 #3
meiko
1
I am attempting to wordwrap in detailsview, but my code looks alittle different then what is below (I was trying to follow your example, but my code is diff.) Could you explain with my code below:
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" BackColor="White"
BorderColor="#336666" BorderStyle="Double" BorderWidth="3px" CellPadding="4"
DataKeyNames="pk_empid" DataSourceID="ObjectDataSource1" Font-Names="Arial" Font-Size="Small"
Height="50px" Width="640px" EditRowStyle-Wrap=true CommandRowStyle-Wrap=true InsertRowStyle-Wrap=true RowStyle-Wrap=true>
<FooterStyle BackColor="White" ForeColor="#333333" />
<EditRowStyle BackColor="White" Font-Bold="True" ForeColor="Black" BorderColor="Maroon" BorderStyle="Double" BorderWidth="1px" Width="450px" Wrap=True CssClass="boxes" />
<RowStyle BackColor="White" ForeColor="#333333" Wrap="True" />
<PagerStyle BackColor="#336666" ForeColor="White" HorizontalAlign="Center" />
<Fields>
<asp:BoundField DataField="pk_empid" HeaderText="pk_empid" InsertVisible="False"
ReadOnly="True" SortExpression="pk_empid" Visible="False" />
<asp:BoundField DataField="vch_empname" HeaderText="Name" SortExpression="vch_empname">
<HeaderStyle Width="100px" />
</asp:BoundField>
<asp:BoundField DataField="vch_empdept" HeaderText="Department" SortExpression="vch_empdept" />
<asp:BoundField DataField="vch_empext" HeaderText="Ext." SortExpression="vch_empext" />
<asp:BoundField DataField="vch_emppic" HeaderText="MugShot" SortExpression="vch_emppic">
<ControlStyle Width="350px" CssClass="boxes"/>
</asp:BoundField>
<asp:BoundField DataField="vch_atwork" HeaderText="At Work" HtmlEncode="False" SortExpression="vch_atwork">
<ControlStyle Height="75px" Width="450px" CssClass="boxes" />
<ItemStyle Wrap="True" />
</asp:BoundField>
<asp:BoundField DataField="vch_forfun" HeaderText="For Fun" HtmlEncode="False" SortExpression="vch_forfun">
<ControlStyle Height="75px" Width="450px" CssClass="boxes"/>
<ItemStyle Wrap="True" />
</asp:BoundField>
<asp:BoundField DataField="vch_mystory" HeaderText="My Story" HtmlEncode="False"
SortExpression="vch_mystory" >
<ControlStyle Height="75px" Width="450px" CssClass="boxes"/>
<ItemStyle Wrap="True" />
</asp:BoundField>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
</Fields>
<HeaderStyle BackColor="#336666" Font-Bold="True" ForeColor="White" Width="75px" />
<CommandRowStyle CssClass="boxes" Wrap="True" />
<InsertRowStyle Wrap="True" />
</asp:DetailsView>

Thanks!


"Jason" <jasonmwilkerson@hotmail.com> wrote in message
news:1147710260.805725.186660@y43g2000cwc.googlegr oups.com...[color=blue]
> Anyone know how to make the text wrap in a text box of a DetailsView?
>[/color]

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
May 19 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Bernerd | last post: by
reply views Thread by PawelR | last post: by
reply views Thread by Murugan V via DotNetMonster.com | last post: by
reply views Thread by Ceri_Davies | last post: by
10 posts views Thread by Jonathan Smith | last post: by
reply views Thread by AlexUhde | last post: by
1 post views Thread by livre | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.