Join us this Friday for AI in Action at the Virtual Happy Hour! This free virtual event is open to all—enroll now on Academy and don’t miss out.

 

Auto increment value to PropertyList class

Vote:
 

Hi Team,

I have a requirement to auto increment PropertyList class value. Can you please provide suggestions to acheive this? Below are the classes which i have created.

public class QuestionOption
{
private int _id;

[Required]
[Editable(false)]
public virtual int Id
{
get
{
return _id;
}

set
{
_id = value;
}
}

[Required]
public virtual string Name { get; set; }
}

/// <summary>
/// Selection base page
/// </summary>
public class SelectionBase : QuestionBasePage
{
/// <summary>
/// Gets or sets the options
/// </summary>
[Display(
GroupName = SystemTabNames.Content,
Name = "Options",
Order = 100)]
[EditorDescriptor(EditorDescriptorType = typeof(CollectionEditorDescriptor<QuestionOption>))]
public virtual IList<QuestionOption> Options { get; set; }
}

#201116
Feb 06, 2019 11:55
Vote:
 

If you hook in to the IContentEvents service you can put an event in for the page updating then programatically set the value by looking through the IList.

#201121
Edited, Feb 06, 2019 12:57
Vote:
 

Hi Scott Reed,

Thanks for the update. I am using "PublishingContent" event to fix this issue.

#201129
Feb 06, 2019 13:44
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.