Dharmesh Sharma

Dharmesh Sharma

  • NA
  • 905
  • 928.8k

How to bind 350 char in html by evel in list view

Jun 27 2011 3:31 AM
hello to all

 i am creating a web page in my page i use list view and i bind the data by evel()

now client wants the description only 350 char i do that but probelm is if char is more then 350 the its work but if char of desc is less 350 the show error

"Index and length must refer to a location within the string.
Parameter name: length "


i know its right but i did not get any solution i dont want to in c# code its a IInd option i want if any solution in aspx page my code samlpe is

     <asp:ListView runat="server" ID="list_members">                                             <LayoutTemplate>                                                 <div id="itemPlaceholderContainer" runat="server">                                                     <span id="itemPlaceholder" runat="server" />                                                 </div>                                             </LayoutTemplate>                                             <EmptyDataTemplate>                                                 <div style="height: 20px; background-color: #d0fdff; margin-top: 20px; margin-bottom: 10px;">                                                     Sorry No Data Found</div>                                             </EmptyDataTemplate>                                             <ItemTemplate>                                                 <table style="margin: 5px; width: 640px;" cellspacing="0" cellpadding="0">                                                     <tr style="background-color: #d0fdff;">                                                         <td style="height: 20px; margin-top: 20px; margin-bottom: 10px;">                                                             <%#Eval("Company"%>                                                         </td>                                                         <td style="height: 20px; margin-top: 20px; margin-bottom: 10px;" align="right" colspan="2">                                                             <table>                                                                 <tr>                                                                     <td>                                                                         <%#Eval("forname"%>                                                                     </td>                                                                     <td>                                                                         <%#Eval("surname"%>,                                                                     </td>                                                                     <td>                                                                         <%#Eval("postion"%>                                                                     </td>                                                                 </tr>                                                             </table>                                                         </td>                                                     </tr>                                                     <tr>                                                         <td style="font-size: 10pt; width: 200px;">                                                             <%#Eval("address1"%><br />                                                             <%#Eval("address2"%>                                                             <br />                                                             <br />                                                             <%#Eval("phone"%>,                                                             <%#Eval("mobile"%>                                                             <br />                                                             <%#Eval("email"%>                                                         </td>                                                         <td style="margin-left: 20px; font-size: 10pt; width: 250px; padding-top: 10px;"                                                             valign="top">                                                             <%#Eval("shortdesc").ToString().Substring(0,350) %>                                                         </td>                                                         <td style="font-size: 10pt; width: 100px; border: 1px solid #dfdfdf; height: 100px;"                                                             valign="top" align="left">                                                             <table>                                                                 <tr>                                                                     <td>                                                                         <asp:Image ID="Image1" runat="server" ImageUrl='<%#Eval("logo")%>' Width="100px"  Height="100px" />                                                                     </td>                                                                 </tr>                                                             </table>                                                         </td>                                                     </tr>                                                 </table>                                             </ItemTemplate>                                         </asp:ListView>
in green background line i have problem n i want to some solution in aspx page
coz i dont know more in evel funtion so plz help me

Dharmesh sharma



Answers (3)