Wrap="False" and Fixed width Gridview...

In a gridview like :

<ItemStyle HorizontalAlign="Left" Width="10px" Wrap="True" /> </asp:BoundField>

When set Wrap="False", it ignores Width="10px". It uses as much as it needs to display the data in full.

Question: Is there any way to have Wrap="False" and force not to exceed 10px?

visual studio 201 c#.

Thank you.
LVL 34
Mike EghtebasDatabase and Application DeveloperAsked:
Who is Participating?
Carl TawnConnect With a Mentor Systems and Integration DeveloperCommented:
The simplest way would be to apply a CSS style to your page to add an overflow style to your td elements by adding the following to the HEAD section of your page:
<style type="text/css">
   td { overflow: hidden; }

Open in new window

Bear in mind that would apply to all td elements. If you just wanted it for the single column you would need to add the CssClass attribute to your ItemStyle and then create a named CSS style.
Mike EghtebasDatabase and Application DeveloperAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.