Error after adding second blog - Charity Starter Kit
Hi there,
I'm using the Charity Starter Kit as a starting point. I'm using the default solution with only cosmetic changes to the style sheets so far. Through the admin I added a second blog called, "Life at DCA" but didn't add any post to it initially. I then navigate to the blog page (the one provided with the starter kit) and there are no problems. Then I go back to admin and add a first post to the Life at DCA blog. Now when the blog page loads in the admin section or on the website I get an exception thrown in the debugger. I haven't managed to find a workaround and I'm not much good at debugging through it. Any ideas what's happening here? I've included the exception details below. Again, I'm just loading the Charity Starter Kit and added a second blog. I'm running VS2010, SQL 2008 R2 on Windows 7 Ultimate 64-bit.
System.ArgumentOutOfRangeException was unhandled by user code
Message=Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: startIndex
Source=mscorlib
ParamName=startIndex
StackTrace:
at System.String.LastIndexOf(String value, Int32 startIndex, Int32 count, StringComparison comparisonType)
at System.String.LastIndexOf(String value, Int32 startIndex)
at SitefinityWebApp.Tools.Truncate.CreateChildControls() in D:\Load\Sitefinity\Charity_Source_4.0.1098.0\Website\Tools\Truncate.cs:line 26
at System.Web.UI.Control.EnsureChildControls()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException:
Thanks,
Justin
Hello Justin,
Thank you for contacting Telerik Support.
The problem is cased from this file: ~/Tools/Truncate.cs. Can you please alter the code as bellow:
protected
override
void
CreateChildControls()
if
(Text !=
null
&& Text.Length > Length)
// Don't truncate in the midst of a word
int
iNextSpace = Text.LastIndexOf(
" "
, Length);
Text =
string
.Format(
"0..."
, Text.Substring(0, (iNextSpace > 0) ? iNextSpace : Length).Trim());
base
.CreateChildControls();