The problem is that all editors created by @Html.EditorFor helper are simple textboxes. I guess that's because MemberProperties[i].Value is always a string.
My question is - how can I create an editor for bool (true/false) properties (checkbox), date properties(datepicker or something like this), numeric and so on? In "Edit Profile" snippet there is some info in comments about creating a custom editor and putting in in the ~/Views/Shared/EditorTemplates folder. I've tried this way, but I don't understand how to convert the string values to other types keeping those values binded to ProfileModel (and saved in umbraco with all simple textbox properties).
Can anyone suggest the solution? Any examples, code snippets and guides would be very appreciated (for example, if there are custom editortemplates available) . Thanks!
P.S. I'm new to umbraco v.6 and MVC (previously worked with v.4.9), so please feel free to point me on any mistakes or bad practicies (if there are any).
Building simple profile editor based on ProfileModel (Umbraco v. 6)
Hi everyone.
I'm trying to build a simple front end profile editor.
I've created a new Member type with couple of custom properties, and used a standard "Edit Profile" Razor macro.
That works great - I mean, now it's possible to build a quick property editor using piece of code like this:
@Html.LabelFor(m => profileModel.MemberProperties[i].Value, profileModel.MemberProperties[i].Name)
@Html.EditorFor(m => profileModel.MemberProperties[i].Value)
@Html.HiddenFor(m => profileModel.MemberProperties[i].Alias)
}
}
}
The problem is that all editors created by @Html.EditorFor helper are simple textboxes. I guess that's because MemberProperties[i].Value is always a string.
My question is - how can I create an editor for bool (true/false) properties (checkbox), date properties(datepicker or something like this), numeric and so on? In "Edit Profile" snippet there is some info in comments about creating a custom editor and putting in in the ~/Views/Shared/EditorTemplates folder. I've tried this way, but I don't understand how to convert the string values to other types keeping those values binded to ProfileModel (and saved in umbraco with all simple textbox properties).
Can anyone suggest the solution? Any examples, code snippets and guides would be very appreciated (for example, if there are custom editortemplates available) . Thanks!
P.S. I'm new to umbraco v.6 and MVC (previously worked with v.4.9), so please feel free to point me on any mistakes or bad practicies (if there are any).
Hi Ilya,
Try to look solution here : http://our.umbraco.org/forum/umbraco-7/using-umbraco-7/59996-Member-Profile-Page?p=0#comment203413
Thanks
is working on a reply...