473,399 Members | 4,192 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,399 software developers and data experts.

Assigning multiline text to datagrid

Hi,

I have multiline textbox in which i am getting suggestions from user and storing in MS ACCESS table.

While i displaying in datagrid, the text is not coming as multiline. Instead it was binding as continuous line.

ex: input
test1
test2
test3

in datagrid it is displaying as test1 test2 test3

any idea to resolve this.
May 12 '07 #1
9 2404
shweta123
692 Expert 512MB
Hi,

My guess is that you should check the max length for the multiline textbox.
If it's MaxLenght is already greater than the input ,it will show you it in the same line instead of multiple lines.
May 13 '07 #2
gomzi
304 100+
Hi,

I have multiline textbox in which i am getting suggestions from user and storing in MS ACCESS table.

While i displaying in datagrid, the text is not coming as multiline. Instead it was binding as continuous line.

ex: input
test1
test2
test3

in datagrid it is displaying as test1 test2 test3

any idea to resolve this.
If you want to display the output on different lines (i.e. same as input) in a datagrid, then you will have to use a literal tag .
place the literal inside the template field and bind the output from the db to the literal tag.
Also, see to it that before binding the output to the literal tag, you convert the line breaks to <br/>,
i.e. replace vbCrLf in the string that you are binding to <br/>
May 13 '07 #3
Thanks Gomzi,

How can i place litreal tag in template column. I mean where the literal tag is and how can i write codings to convert the line breaks to <br/>
May 14 '07 #4
gomzi
304 100+
Thanks Gomzi,

How can i place litreal tag in template column. I mean where the literal tag is and how can i write codings to convert the line breaks to <br/>

Try this,
Expand|Select|Wrap|Line Numbers
  1.        <asp:GridView ID="GridView1" runat="server">
  2.             <Columns>
  3.                 <asp:TemplateField>
  4.                     <ItemTemplate>
  5.                         <asp:Literal ID="litsomething" runat="Server"></asp:Literal>
  6.                     </ItemTemplate>
  7.                 </asp:TemplateField>
  8.             </Columns>
  9.         </asp:GridView>
  10.  
IN CODE BEHIND,
In page load or whereever you are binding the dataset to a datagrid, run a loop to replace the vbCrLf to <br/> for that column before binding.
THEN,
Expand|Select|Wrap|Line Numbers
  1.  
  2. Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
  3.         If e.Row.RowType = DataControlRowType.DataRow Then
  4.             CType(e.Row.FindControl("litsomething"), Literal).Text = e.Row.DataItem("yourcolumnname")
  5.         End If
  6.     End Sub
  7.  
May 14 '07 #5
Hi Gomzi,

sorry for disturbing you.

still i am not clear. i am doing program in asp.net using vb coding.

could you please explain in detail.
May 15 '07 #6
gomzi
304 100+
Hi Gomzi,

sorry for disturbing you.

still i am not clear. i am doing program in asp.net using vb coding.

could you please explain in detail.
Did you try out the code that i posted last time?
If yes, are you getting any output? or any errors?
May 15 '07 #7
Yes. your coding is working properly.

There is no error in it.

But i not got solution for my question.

I need to display multiline content as such. For Ex: if there is 10 lines in database means i need to display as such.But your coding is not helpful for me.

Because it is displaying the content as a single line. It is not considering more than one space and even the next line.

I need to display the following sample coding in datagrid as such.

This is for testing
multiline
option display in
datagrid
<blank spaces>using asp.net

any idea.
May 18 '07 #8
gomzi
304 100+
Yes. your coding is working properly.

There is no error in it.

But i not got solution for my question.

I need to display multiline content as such. For Ex: if there is 10 lines in database means i need to display as such.But your coding is not helpful for me.

Because it is displaying the content as a single line. It is not considering more than one space and even the next line.

I need to display the following sample coding in datagrid as such.

This is for testing
multiline
option display in
datagrid
<blank spaces>using asp.net

any idea.
Hope you are changing the line feeds from vbCrLf to <br/> .

If you done that too, then I guess posting your code might be helpful in solving the problem.
May 18 '07 #9
Problem resolved as the description in the blog
http://eblog.lichao.net/2007/05/21/p...ing/dotnet/59/
May 21 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Alex K. | last post by:
How do I define multiline column header in DataGrid control? I need two-line headers for some columns. Thank you
7
by: Joel Finkel | last post by:
Folks, I have a form that has several TextBoxes, some of which have the TextMode set to MultiLine. Each is pre-loaded with data from a database. The user is allowed to modify each entry. The...
0
by: angus | last post by:
Dear all, I am using multiline text box(textarea) in datagrid. I've found that i cannot use a new line character. is it my problem? Regards, Angus
1
by: Tracey | last post by:
Hi, there My application requires to display multiline text in the cell of datagrid. I set the preferredheight of datagrid's tablsstyle, however, it is fixed. For text longer than that, the rest...
1
by: jeff maultby | last post by:
Hi All I need to display multiple lines of text in same column in datagrid on display as well as on edit. Want each row's height to auto size on display according to the nbr of lines in the...
1
by: ABC | last post by:
I tried KDNGrid's (www.knowdotnet.com) Multiline textbox column style for datagrid. It is very good but has some bug on wrong handle datagrid height that cannot display the scrollbar when a row...
1
by: Mrozu | last post by:
Help me! I need to make multiline column in Datagrid. It is ReadOnly. Help me;) Thx Mrozu
1
by: Aziz | last post by:
How do I select a DataGrid column (the fourth one) to be multiline so that when there is more text than can fit horizontally, the text will carry on in the next line and automatically change the...
0
by: evilson | last post by:
Hi, I have two textbox, one of the textbx is is set to multiline. Problem is when i try to insert the value of the multiline textbox to the datagridview, it never work. The datagrid's warpmode is...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.