473,287 Members | 1,964 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

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 14542

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Bernerd | last post by:
Would anyone out there tell me how to make my C# datagrid wrap the text in the cells. I haven't seen a good how to out there that does this. I know it has something to do with using styles but...
0
by: PawelR | last post by:
Hi, I wand display in dataGrid (winform application) column with multiline TextBox. In source code I've function: private void DGFormat() { DataGridTableStyle myStyle = new DataGridTableStyle();...
0
by: Murugan V via DotNetMonster.com | last post by:
Hi, i want to add the DropDownList,TextBox and Label in detailsview dynamically at runtime.At the page load, the detailsview displayed the records.when i click the edit button,these controls should...
0
by: Ceri_Davies | last post by:
Hi, Is it possible to bind a text box to the results of a detailsview record. This is for a university project using visual web developer 2005 express beta. Unfortunatly this is a new eniroment to...
0
by: Vonnie | last post by:
I have a DetailsView and the text in a text box won't wrap in the edit mode. I have the item style and editrowstyle set to wrap, but if the data is too long it still won't wrap in a text field . ...
10
by: Jonathan Smith | last post by:
I have a VB app that has a richtextbox with the word wrap set to true. I need to be able to output the text to a text file, but it just puts the text in the file as one long line. How do i...
2
by: André | last post by:
Hi, I made a detailsview containing several fields for inserting only. I also made a dropdownlist which is invisible at start. Now, when clicking in a particular textbox, the dropdownlist must...
0
by: AlexUhde | last post by:
Hello! I'm relative new to asp.net and I'm trying to figure out how i can have a "auto fill" date in a textbox from a DetailsView in insertmode. I know that with <%# Now %in Text='' I can put...
1
by: Lazy Man | last post by:
Hi, custom DetailsView or Table with controls? For various reasons, I need to generate the edit controls in a DetailsView programmatically. I already do this to display an item, so Item mode...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.