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
CSS
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 Founddiv> 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>coz i dont know more in evel funtion so plz help me
Dharmesh sharma


Suthish NairRank #92 · 22.8K reputationPosted Jun 27, 2011, 3:26 AM EDT
Dharmesh SharmaRank #1,974 · 741 reputationPosted Jun 27, 2011, 4:28 AM EDT
thats very simple i know in c# but i want to do on aspx page
u got my question
Suthish NairRank #92 · 22.8K reputationPosted Jun 27, 2011, 4:45 AM EDT
"<%# (Eval("shortdesc").ToString().Length > 350 ? Eval("shortdesc").ToString().Substring(0, 350): Eval("shortdesc").ToString()) %>"