9 Replies - 1467 Views - Last Post: 04 October 2012 - 05:44 AM Rate Topic: -----

#1 Sabra khan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 25
  • Joined: 08-August 12

how to display a comment

Posted 03 October 2012 - 12:52 PM

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

Is This A Good Question/Topic? 0
  • +

Replies To: how to display a comment

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6036
  • View blog
  • Posts: 23,421
  • Joined: 23-August 08

Re: how to display a comment

Posted 03 October 2012 - 01:07 PM

Moved to ASP.NET
Was This Post Helpful? 0
  • +
  • -

#3 h4nnib4l  Icon User is offline

  • The Noid
  • member icon

Reputation: 1181
  • View blog
  • Posts: 1,673
  • Joined: 24-August 11

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.
Was This Post Helpful? 0
  • +
  • -

#4 Sabra khan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 25
  • Joined: 08-August 12

Re: how to display a comment

Posted 03 October 2012 - 01:47 PM

View Posth4nnib4l, 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...
Was This Post Helpful? 0
  • +
  • -

#5 h4nnib4l  Icon User is offline

  • The Noid
  • member icon

Reputation: 1181
  • View blog
  • Posts: 1,673
  • Joined: 24-August 11

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:

<asp:GridView ID="myGridView" runat="server">
    <BoundField ItemStyle-Wrap="True" DataField="myDataField" />
</asp:GridView>



I'm sure you can find something similar for ListView.
Was This Post Helpful? 0
  • +
  • -

#6 Sabra khan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 25
  • Joined: 08-August 12

Re: how to display a comment

Posted 03 October 2012 - 02:46 PM

View Posth4nnib4l, 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
Was This Post Helpful? 0
  • +
  • -

#7 Sabra khan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 25
  • Joined: 08-August 12

Re: how to display a comment

Posted 03 October 2012 - 03:06 PM

View Posth4nnib4l, 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:

<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...
Was This Post Helpful? 0
  • +
  • -

#8 h4nnib4l  Icon User is offline

  • The Noid
  • member icon

Reputation: 1181
  • View blog
  • Posts: 1,673
  • Joined: 24-August 11

Re: how to display a comment

Posted 03 October 2012 - 03:32 PM

Have you tried explicitly setting the width?
Was This Post Helpful? 0
  • +
  • -

#9 Sabra khan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 25
  • Joined: 08-August 12

Re: how to display a comment

Posted 03 October 2012 - 11:43 PM

View Posth4nnib4l, on 03 October 2012 - 03:32 PM, said:

Have you tried explicitly setting the width?



yes I have tried all but still not getting any solution....
Was This Post Helpful? 0
  • +
  • -

#10 Nakor  Icon User is offline

  • Professional Lurker
  • member icon

Reputation: 441
  • View blog
  • Posts: 1,488
  • Joined: 28-April 09

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

This post has been edited by Nakor: 04 October 2012 - 05:45 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1