Increasing character limit for summary

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
Post Reply
Brewhaus
Vice Admiral (VADM)
Vice Admiral (VADM)
Posts: 878
Joined: Sat Jan 19, 2008 4:30 pm

Increasing character limit for summary

Post by Brewhaus » Thu Oct 23, 2014 9:45 am

Because we are building our blog into our AC website (using Webpages) we want to increase the limit for the length of the summary field. I looked through a couple of files, but could not find where the summary length was set. Can someone point me in the right direction?
Rick Morris
Brewhaus (America) Inc.
Hot Sauce Depot

User avatar
Naveed
Rear Admiral (RADM)
Rear Admiral (RADM)
Posts: 611
Joined: Thu Apr 03, 2008 4:48 am

Re: Increasing character limit for summary

Post by Naveed » Thu Oct 23, 2014 11:18 pm

Open the ~/Admin/Website/ContentPages/EditContentPage.aspx file for editing, and locate the line with following code:

<cb:HtmlEditor ID="Summary" runat="server" Width="100%" Height="200px" ToolbarSet="Inline" MaxLength="1000" />

Change the value of MaxLength to your desired value, or remove the attribute. The database length for the respective Summary filed is NVARCHAR(MAX), so you do not need to worry about max length for this field.

You also need to update the ~/Admin/Website/ContentPages/AddContentPage.aspx file for summary field length.

Brewhaus
Vice Admiral (VADM)
Vice Admiral (VADM)
Posts: 878
Joined: Sat Jan 19, 2008 4:30 pm

Re: Increasing character limit for summary

Post by Brewhaus » Fri Oct 24, 2014 6:32 am

I tried changing the MaxLength variable for:

../Admin/Website/ContentPages/EditContentPage.aspx
../Admin/Website/ContentPages/AddContentPage.aspx
../Admin/Catalog/EditWebpage.aspx (this is the page referenced in the address bar when we are editing the webpage)

All were increased from 1000 to 5000. We still get an error.

I had changed the EditWebpage.aspx yesterday, but had my doubts, as we are not able to enter 1000 characters now. We are limited to about 1010 characters (total characters, including HTML tags).

Note: The error is not thrown by the HTML editor- it is thrown when we try to save the webpage.
Rick Morris
Brewhaus (America) Inc.
Hot Sauce Depot

User avatar
Naveed
Rear Admiral (RADM)
Rear Admiral (RADM)
Posts: 611
Joined: Thu Apr 03, 2008 4:48 am

Re: Increasing character limit for summary

Post by Naveed » Fri Oct 24, 2014 8:54 am

I tested by setting MaxLength="5000", and it works good. I am able to save value upto 5000 characters without any issue. What error you are getting, post details please.

Brewhaus
Vice Admiral (VADM)
Vice Admiral (VADM)
Posts: 878
Joined: Sat Jan 19, 2008 4:30 pm

Re: Increasing character limit for summary

Post by Brewhaus » Fri Oct 24, 2014 9:50 am

Here is the error:

Code: Select all

 String or binary data would be truncated.
The statement has been terminated.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: String or binary data would be truncated.
The statement has been terminated.

Source Error:

The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

1. Add a "Debug=true" directive at the top of the file that generated the error. Example:

  <%@ Page Language="C#" Debug="true" %>

or:

2) Add the following section to the configuration file of your application:

<configuration>
   <system.web>
       <compilation debug="true"/>
   </system.web>
</configuration>

Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.

Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.

Stack Trace:


[SqlException (0x80131904): String or binary data would be truncated.
The statement has been terminated.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +1753346
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5295154
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +242
   System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +1682
   System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +269
   System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite) +1325
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +175
   System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite) +205
   System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +160
   NHibernate.AdoNet.AbstractBatcher.ExecuteNonQuery(IDbCommand cmd) +286
   NHibernate.AdoNet.NonBatchingBatcher.AddToBatch(IExpectation expectation) +49
   NHibernate.Persister.Entity.AbstractEntityPersister.Update(Object id, Object[] fields, Object[] oldFields, Object rowId, Boolean[] includeProperty, Int32 j, Object oldVersion, Object obj, SqlCommandInfo sql, ISessionImplementor session) +1041

[GenericADOException: could not update: [CommerceBuilder.Catalog.Webpage#33][SQL: UPDATE ac_Webpages SET Summary = ? WHERE WebpageId = ?]]
   NHibernate.Persister.Entity.AbstractEntityPersister.Update(Object id, Object[] fields, Object[] oldFields, Object rowId, Boolean[] includeProperty, Int32 j, Object oldVersion, Object obj, SqlCommandInfo sql, ISessionImplementor session) +1257
   NHibernate.Persister.Entity.AbstractEntityPersister.UpdateOrInsert(Object id, Object[] fields, Object[] oldFields, Object rowId, Boolean[] includeProperty, Int32 j, Object oldVersion, Object obj, SqlCommandInfo sql, ISessionImplementor session) +195
   NHibernate.Persister.Entity.AbstractEntityPersister.Update(Object id, Object[] fields, Int32[] dirtyFields, Boolean hasDirtyCollection, Object[] oldFields, Object oldVersion, Object obj, Object rowId, ISessionImplementor session) +654
   NHibernate.Action.EntityUpdateAction.Execute() +400
   NHibernate.Engine.ActionQueue.Execute(IExecutable executable) +34
   NHibernate.Engine.ActionQueue.ExecuteActions(IList list) +59
   NHibernate.Engine.ActionQueue.ExecuteActions() +27
   NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session) +182
   NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event) +92
   NHibernate.Impl.SessionImpl.Flush() +346
   CommerceBuilder.DomainModel.RepositoryWithTypedId`2.Save(TEntity item) +104

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +92
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +108
   CommerceBuilder.DomainModel.EntityWithTypedId`1.Save() +293
   AbleCommerce.Admin.Catalog.EditWebpage.SaveButton_Click(Object sender, EventArgs e) +655
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9553594
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +103
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724
Rick Morris
Brewhaus (America) Inc.
Hot Sauce Depot

User avatar
Naveed
Rear Admiral (RADM)
Rear Admiral (RADM)
Posts: 611
Joined: Thu Apr 03, 2008 4:48 am

Re: Increasing character limit for summary

Post by Naveed » Fri Oct 24, 2014 6:18 pm

I checked again the database type for ac_Webpages.Summary field is NVARCHAR(MAX), so it should not be an issue. From from your error log it is clear, that your issue is the field length.
String or binary data would be truncated.
The statement has been terminated
...
[GenericADOException: could not update: [CommerceBuilder.Catalog.Webpage#33][SQL: UPDATE ac_Webpages SET Summary = ? WHERE WebpageId = ?]]
Which version of AC Gold you are using? I checked Gold R3 as well, and the field type and length is same. If the issue persists you have to increase the field length in database.

Brewhaus
Vice Admiral (VADM)
Vice Admiral (VADM)
Posts: 878
Joined: Sat Jan 19, 2008 4:30 pm

Re: Increasing character limit for summary

Post by Brewhaus » Sat Oct 25, 2014 6:24 am

I am currently on Gold R8, and plan to move to R9 shortly.
Rick Morris
Brewhaus (America) Inc.
Hot Sauce Depot

Post Reply