I am developing c# web application .net frame work 4.5.
I used a database for storing feedback from users. for displaying comments i used all of these (datalist, list view, gridview,formview, detail view) but problem is that when the comment is a long string, whole string is printed in single line, which realy destroyes beauty of a page.
Name: aaa
Email: @yahoo
Feedback: zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
DateAdded: 10/3/2012 12:00:00 AM</pre>
this whole line is printed in single line.
i want if there is a long string, suppose more than 100 charecters. i want to display 100 char in one line and rest of string in next line.
is there any possibilty with either of control, specially i am interested in list view.
is there any possibilty with list view to print a long string in more than one line????
another question is that is there any posibilty with list view to delete any comment?????
thanks
how to display a comment
Page 1 of 19 Replies - 552 Views - Last Post: 04 October 2012 - 05:44 AM
Replies To: how to display a comment
#3
Re: how to display a comment
Posted 03 October 2012 - 01:21 PM
When using BoundFields in a GridView, you can set ItemStyle-Wrap="true" to get the text to wrap to the next line. I don't have any experience with ListViews, and I'm not going to do the research for you, but I'm sure there is a way to accomplish it with that control as well.
#4
Re: how to display a comment
Posted 03 October 2012 - 01:47 PM
h4nnib4l, on 03 October 2012 - 01:21 PM, said:
When using BoundFields in a GridView, you can set ItemStyle-Wrap="true" to get the text to wrap to the next line. I don't have any experience with ListViews, and I'm not going to do the research for you, but I'm sure there is a way to accomplish it with that control as well.
I didn't find this option...
#5
Re: how to display a comment
Posted 03 October 2012 - 02:07 PM
Where did you look?
BoundField inherits from DataControlField, which has an ItemStyle property. ItemStyle is a "TableItemStyle that governs the appearance of text displayed in a DataControlField" (from the MSDN Page). The TableItemStyle page lists all of the properties you can set and methods you can call against any type of DataControlField (like a BoundField, for example). For my GridView example:
I'm sure you can find something similar for ListView.
BoundField inherits from DataControlField, which has an ItemStyle property. ItemStyle is a "TableItemStyle that governs the appearance of text displayed in a DataControlField" (from the MSDN Page). The TableItemStyle page lists all of the properties you can set and methods you can call against any type of DataControlField (like a BoundField, for example). For my GridView example:
<asp:GridView ID="myGridView" runat="server">
<BoundField ItemStyle-Wrap="True" DataField="myDataField" />
</asp:GridView>
I'm sure you can find something similar for ListView.
#6
Re: how to display a comment
Posted 03 October 2012 - 02:46 PM
h4nnib4l, on 03 October 2012 - 01:21 PM, said:
When using BoundFields in a GridView, you can set ItemStyle-Wrap="true" to get the text to wrap to the next line. I don't have any experience with ListViews, and I'm not going to do the research for you, but I'm sure there is a way to accomplish it with that control as well.
I serched for item style but couldn't find it, will you please tell me with little explaination that how to use (ItemStyle-Wrap="true"
thanks
#7
Re: how to display a comment
Posted 03 October 2012 - 03:06 PM
h4nnib4l, on 03 October 2012 - 02:07 PM, said:
Where did you look?
BoundField inherits from DataControlField, which has an ItemStyle property. ItemStyle is a "TableItemStyle that governs the appearance of text displayed in a DataControlField" (from the MSDN Page). The TableItemStyle page lists all of the properties you can set and methods you can call against any type of DataControlField (like a BoundField, for example). For my GridView example:
I'm sure you can find something similar for ListView.
BoundField inherits from DataControlField, which has an ItemStyle property. ItemStyle is a "TableItemStyle that governs the appearance of text displayed in a DataControlField" (from the MSDN Page). The TableItemStyle page lists all of the properties you can set and methods you can call against any type of DataControlField (like a BoundField, for example). For my GridView example:
<asp:GridView ID="myGridView" runat="server">
<BoundField ItemStyle-Wrap="True" DataField="myDataField" />
</asp:GridView>
I'm sure you can find something similar for ListView.
I have tried exactly the same code but it is not working...
#8
Re: how to display a comment
Posted 03 October 2012 - 03:32 PM
Have you tried explicitly setting the width?
#9
Re: how to display a comment
Posted 03 October 2012 - 11:43 PM
#10
Re: how to display a comment
Posted 04 October 2012 - 05:44 AM
You can always use a textbox control instead of a label and set its textmode to multiline and set it to read only.
another option is to wrap it in a div, set a width to the div and use the css style overflow: auto
or put it in an asp:Panel and set the width and scrollbars properties
If using a gridview control you'll need to put it in a templatefield, but a listview will let you do pretty much anything you want
another option is to wrap it in a div, set a width to the div and use the css style overflow: auto
or put it in an asp:Panel and set the width and scrollbars properties
If using a gridview control you'll need to put it in a templatefield, but a listview will let you do pretty much anything you want
This post has been edited by Nakor: 04 October 2012 - 05:45 AM
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote







|