How to Create Profile Property through Coding in DNN

How to Create Profile Property through Coding in DNN

//Here ‘Level’ is the name of profile property

if (DotNetNuke.Entities.Profile.ProfileController.GetPropertyDefinitionByName(this.PortalId, “Level”) == null)
{
DotNetNuke.Entities.Profile.ProfileController.AddPropertyDefinition(
new DotNetNuke.Entities.Profile.ProfilePropertyDefinition(this.PortalId)
{
PropertyName = “Level”,
DataType = 10,
PropertyCategory=”Level”,
Length=100,
Visible=true
});
}

//Here txtLevel is the Textbox Control for assigning of this textbox value to Profile Property ‘Level’
oUser.Profile.SetProfileProperty(“Level”, txtLevel.Text);

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply