473,654 Members | 2,987 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 14569

"Jason" <ja************ *@hotmail.com> wrote in message
news:11******** **************@ y43g2000cwc.goo glegroups.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:DetailsVie w ID="DetailsView 1" runat="server"
DataSourceID="S qlDataSource1" Height="50px"

Width="125px" AutoGenerateRow s="False" AllowPaging="Tr ue">

<Fields>

<asp:CommandFie ld ShowEditButton= "True" />

<asp:TemplateFi eld HeaderText="Fir stName" SortExpression= "FirstName" >

<EditItemTempla te>

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

</EditItemTemplat e>

<InsertItemTemp late>

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

</InsertItemTempl ate>

<ItemTemplate >

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

</ItemTemplate>

</asp:TemplateFie ld>

<asp:BoundFie ld 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 New Member
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:DetailsVie w ID="DetailsView 1" runat="server" AutoGenerateRow s="False" BackColor="Whit e"
BorderColor="#3 36666" BorderStyle="Do uble" BorderWidth="3p x" CellPadding="4"
DataKeyNames="p k_empid" DataSourceID="O bjectDataSource 1" Font-Names="Arial" Font-Size="Small"
Height="50px" Width="640px" EditRowStyle-Wrap=true CommandRowStyle-Wrap=true InsertRowStyle-Wrap=true RowStyle-Wrap=true>
<FooterStyle BackColor="Whit e" ForeColor="#333 333" />
<EditRowStyle BackColor="Whit e" Font-Bold="True" ForeColor="Blac k" BorderColor="Ma roon" BorderStyle="Do uble" BorderWidth="1p x" Width="450px" Wrap=True CssClass="boxes " />
<RowStyle BackColor="Whit e" ForeColor="#333 333" Wrap="True" />
<PagerStyle BackColor="#336 666" ForeColor="Whit e" HorizontalAlign ="Center" />
<Fields>
<asp:BoundFie ld DataField="pk_e mpid" HeaderText="pk_ empid" InsertVisible=" False"
ReadOnly="True" SortExpression= "pk_empid" Visible="False" />
<asp:BoundFie ld DataField="vch_ empname" HeaderText="Nam e" SortExpression= "vch_empnam e">
<HeaderStyle Width="100px" />
</asp:BoundField>
<asp:BoundFie ld DataField="vch_ empdept" HeaderText="Dep artment" SortExpression= "vch_empdep t" />
<asp:BoundFie ld DataField="vch_ empext" HeaderText="Ext ." SortExpression= "vch_empext " />
<asp:BoundFie ld DataField="vch_ emppic" HeaderText="Mug Shot" SortExpression= "vch_emppic ">
<ControlStyle Width="350px" CssClass="boxes "/>
</asp:BoundField>
<asp:BoundFie ld DataField="vch_ atwork" HeaderText="At Work" HtmlEncode="Fal se" SortExpression= "vch_atwork ">
<ControlStyle Height="75px" Width="450px" CssClass="boxes " />
<ItemStyle Wrap="True" />
</asp:BoundField>
<asp:BoundFie ld DataField="vch_ forfun" HeaderText="For Fun" HtmlEncode="Fal se" SortExpression= "vch_forfun ">
<ControlStyle Height="75px" Width="450px" CssClass="boxes "/>
<ItemStyle Wrap="True" />
</asp:BoundField>
<asp:BoundFie ld DataField="vch_ mystory" HeaderText="My Story" HtmlEncode="Fal se"
SortExpression= "vch_mystor y" >
<ControlStyle Height="75px" Width="450px" CssClass="boxes "/>
<ItemStyle Wrap="True" />
</asp:BoundField>
<asp:CommandFie ld ShowDeleteButto n="True" ShowEditButton= "True" />
</Fields>
<HeaderStyle BackColor="#336 666" Font-Bold="True" ForeColor="Whit e" Width="75px" />
<CommandRowStyl e CssClass="boxes " Wrap="True" />
<InsertRowSty le Wrap="True" />
</asp:DetailsView >

Thanks!


"Jason" <jasonmwilkerso n@hotmail.com> wrote in message
news:1147710260 .805725.186660@ y43g2000cwc.goo glegroups.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:DetailsVie w ID="DetailsView 1" runat="server"
DataSourceID="S qlDataSource1" Height="50px"

Width="125px" AutoGenerateRow s="False" AllowPaging="Tr ue">

<Fields>

<asp:CommandFie ld ShowEditButton= "True" />

<asp:TemplateFi eld HeaderText="Fir stName" SortExpression= "FirstName" >

<EditItemTempla te>

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

</EditItemTemplat e>

<InsertItemTemp late>

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

</InsertItemTempl ate>

<ItemTemplate >

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

</ItemTemplate>

</asp:TemplateFie ld>

<asp:BoundFie ld 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
3528
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 haven't got styles to work right yet with my grid that get's dynamically populated by xml files. Here's my code that gets the grid. private void mnuContacts_Click(object sender, System.EventArgs e) {
0
2663
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(); DataGridColumnStyle kKontroler = new DataGridTextBoxColumn(); kKontroler.MappingName = "uiName"; kKontroler.Alignment = HorizontalAlignment.Left; kKontroler.Width = 120;
0
1679
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 be added in the detailsview above the row of edit/update/cancel button.when i select the dropdownlist,the selected items should be displayed in the label text.For example, Label TextBox DropDownList ------------------------------ One |...
0
960
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 me and i can't find any relevant resources on it. The code i have been trying to use is: </asp:DetailsView> <asp:TextBox ID="TextBox1" Runat="server" Text='<%# ObjectDataSource1("StockCode")%>' > </asp:TextBox>
0
1120
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 . the field is SQL bound and an ntext datatype any help appreciated
10
4071
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 replace word wrap (i.e. soft returns) with carriage returns?
2
3198
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 become visible (in order to put the selected value of the dropdownlist into the textbox of the detailsgrid.). I must say, the detailsview contains textboxes, but also a checkbox. I tried a lot of things, but i don't know which events to take:
0
1418
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 the Date in the TextBox Field. And I know that i can use <%# Bind="date" %to bind it to the date part of the sql query. But how can I make both with one textbox?
1
3928
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 is fine, and the snippet below does the work. But I've been struggling mightily to make edit mode work. So the first question is, should I customize a DetailsView control, or should I build a table and embed the appropriate TextBoxes etc?
0
8290
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8815
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8708
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8489
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8594
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5622
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4149
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2716
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1596
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.