dotnetnuke - Create ProfileProperty Through Code in DNN -
how create profile property through code in dnn (dotnetnuke)?
i tried code:
dotnetnuke.entities.profile.profilepropertydefinition def = dotnetnuke.entities.profile.profilecontroller.getpropertydefinitionbyname(this.portalid, "level"); if (def != null) { def.datatype = 10; def.length = 40; def.propertyvalue = "level"; def.propertyname = "level"; ouser.profile.profileproperties.add(def); } ouser.profile.setprofileproperty("level", ddllevel.selecteditem.text.tostring().trim()); dotnetnuke.entities.profile.profilecontroller.updateuserprofile(ouser, ouser.profile.profileproperties);
but won't work, please help me suitable solution.
try out code adding 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 = "name", datatype = 10, ... }); }
dotnetnuke user-profile
No comments:
Post a Comment