codeSource---html helper

if some string that we want to display are long enough ,which would throw off our table formatting.so we need a html helper to allow us to easily truncate these string .

 

HtmlHelper
   
     
public static class HtmlHelpers
{
public static string Truncate( string input, int length)
{
if (input.Length <= length)
{
return input;
}
else
{
return input.Substring( 0 , length) + " ... " ;
}
}
}

 

你可能感兴趣的:(source)