.net指定漢字が長さを超えた部分は省略記号で置き換えられました


///   <summary>     
   ///                  ,     
   ///   </summary>     
   ///   <param   name= "oldStr ">          </param>     
   ///   <param   name= "maxLength ">          </param>     
   ///   <param   name= "endWith ">         </param>     
   ///   <returns>       ,              ,  ,       </returns>     
   public static string StringTruncat(string oldStr, int maxLength, string endWith)   
   {   
       if (string.IsNullOrEmpty(oldStr))   
           //   throw   new   NullReferenceException( "         ");     
           return oldStr + endWith;   
       if (maxLength < 1)   
           throw new Exception("            [0] ");   
       if (oldStr.Length > maxLength)   
       {   
           string strTmp = oldStr.Substring(0, maxLength);   
           if (string.IsNullOrEmpty(endWith))   
               return strTmp;   
           else   
               return strTmp + endWith;   
       }   
       return oldStr;   
   } 

フロントコード:
<asp:TemplateField HeaderText="    ">
<ItemTemplate>                                        <!--      --> <!--              --> <!--         ...  -->
<a href='newscontent.aspx?newsid=<%# Eval("id") %>'target="_blank" title='<%# Eval("title")%>'> <%# StringTruncat( Eval("title").ToString(),17,"...") %></a> 
</ItemTemplate>
</asp:TemplateField>