IT Community - Software Programming, Web Development and Technical Support

How to break text inside the asp.net datagrid columns that exceeds the width?

This is a discussion on How to break text inside the asp.net datagrid columns that exceeds the width? within the HTML, CSS and Javascript Coding Techniques forums, part of the Web Development category; To break the text that exceeds the width of ASP.net Datagrid web control or tables row width, Use CSS ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > HTML, CSS and Javascript Coding Techniques

Register FAQ Members List Calendar Mark Forums Read
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 02-15-2008, 06:08 AM
vadivelanshanmugam vadivelanshanmugam is offline
D-Web Trainee
 
Join Date: Jan 2008
Posts: 41
vadivelanshanmugam is on a distinguished road
Default How to break text inside the asp.net datagrid columns that exceeds the width?

To break the text that exceeds the width of ASP.net Datagrid web control or tables row width, Use CSS level 3 word-break property.

Example for word-break property:

td { word-break: break-all }

Use the above code in your asp.net and see the magic.

Note: This will works only in Internet Explorer 6 or above. If You find any code snippets that works with other browsers, please post it.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 03-05-2008, 02:58 AM
rrrajesh84in rrrajesh84in is offline
D-Web Master
 
Join Date: Mar 2007
Posts: 399
rrrajesh84in is on a distinguished road
Default Re: How to break text inside the asp.net datagrid columns that exceeds the width?

hi

by inserting a space between string dynamically we can stop breaking layout of those text in a grid. use this javascrip to insert space.



function InsertSpaceInString(textWithoutSpace,size,controlN ame)
{
var controlToBind = document.getElementById(controlName);
var textWithSpace = "";
var temp = textWithoutSpace.split(" ");
//alert(textWithoutSpace);
for (var i = 0; i < temp.length; i++)
{
var spliter = "";
var remaining = "";
if (temp[i].length > size)
{
var loopCount = temp[i].length / size;
remaining = temp[i];
for (var j = 1; j <= loopCount; j++)
{
var a = remaining.substring(0, size);
remaining = remaining.substring((size));
spliter = spliter + a + " ";
}
temp[i] = spliter + remaining;
}
textWithSpace = " " + textWithSpace + temp[i] + " ";
}
if (textWithSpace.length > 0)
{
var temperorary = textWithSpace.trim();
textWithSpace = temperorary;
}
controlToBind.innerHTML = textWithSpace;
}
__________________
.....................................
''''''
Rajesh''''''
Ants. . . . . . Like me
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

LinkBacks (?)
LinkBack to this Thread: http://www.discussweb.com/html-css-javascript-coding-techniques/5269-how-break-text-inside-asp-net-datagrid-columns-exceeds-width.html
Posted By For Type Date
CSS JavaScript: Blogs, Photos, Videos and more on Technorati This thread Refback 02-26-2008 12:14 AM

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create index for all columns in a view? oxygen Database Support 1 02-07-2008 01:53 AM
Break .exe into .pl Vani Sri Perl 0 01-29-2008 05:34 AM
How do I check that text entered in a text form field is an integer? itbarota HTML, CSS and Javascript Coding Techniques 2 10-26-2007 12:25 AM
Why doesn't <TABLE WIDTH="100%"> use the full browser width? oxygen HTML, CSS and Javascript Coding Techniques 1 07-27-2007 03:38 AM
How to sort the datagrid columns in ascending order and decending order using c# dot? Archer C# Programming 1 07-22-2007 11:28 PM


All times are GMT -7. The time now is 11:21 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0