Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
I am trying to get sort order inside "AfterPublish" event but always getting 0. In data file and the database sort order is correct.
Thank you in advance.
Regards,
Janaka
Can you post the code that you're using?
public DocumentEventHandler()
{
Document.AfterPublish += new Document.PublishEventHandler(Document_AfterPublish);
}
void Document_AfterPublish(Document sender, umbraco.cms.businesslogic.PublishEventArgs e)
LatestUploads.InsertOrUpdateLatestProperties(sender);
Log.Add(LogTypes.Custom, sender.Id, "Document Before save Raised");
if (sender.Template > 0)
//SQLite dbtask
DatabaseTask dbTask = new DatabaseTask();
int sortOdr = sender.sortOrder;
string isHide = sender.getProperty("isMenuHide") ==null ? "0" : String.IsNullOrEmpty(sender.getProperty("isMenuHide").Value.ToString())?"0": sender.getProperty("isMenuHide").Value.ToString();
//insert to sqlite database
dbTask.InsertUpdatePages(sender.Id, sender.ContentType.Alias, sender.Text, JSONDocument.IterateThroughNodes(sender), isHide, sortOdr);
I get the node from document and user sortOrder of the node which gave me the correct sort order.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Sort order is always 0
Hi,
I am trying to get sort order inside "AfterPublish" event but always getting 0. In data file and the database sort order is correct.
Thank you in advance.
Regards,
Janaka
Can you post the code that you're using?
public DocumentEventHandler()
{
Document.AfterPublish += new Document.PublishEventHandler(Document_AfterPublish);
}
void Document_AfterPublish(Document sender, umbraco.cms.businesslogic.PublishEventArgs e)
{
LatestUploads.InsertOrUpdateLatestProperties(sender);
Log.Add(LogTypes.Custom, sender.Id, "Document Before save Raised");
if (sender.Template > 0)
{
//SQLite dbtask
DatabaseTask dbTask = new DatabaseTask();
int sortOdr = sender.sortOrder;
string isHide = sender.getProperty("isMenuHide") ==null ? "0" : String.IsNullOrEmpty(sender.getProperty("isMenuHide").Value.ToString())?"0": sender.getProperty("isMenuHide").Value.ToString();
//insert to sqlite database
dbTask.InsertUpdatePages(sender.Id, sender.ContentType.Alias, sender.Text, JSONDocument.IterateThroughNodes(sender), isHide, sortOdr);
}
}
I get the node from document and user sortOrder of the node which gave me the correct sort order.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.