This seems like a fairly straightforward problem but I keep getting the same exception and I have no idea why.
I can only assume that it has something to do with a misunderstanding of how substring works in VB.NET.
The following code, keeps throwing a ArgumentOutOfRange exception:
<%=Html.Encode(IIf(item.description.Length > 150, item.description.Substring(0, 150), item.description))%>
Now what should happen here is, if item.description is over a 150 characters output the first 150 otherwise output the entire string. Problem is it keeps trying to get the sub-string regardless of the length of the result of the if statement.
Any help would be greatly appreciated.