My class have an Image Property as byte[].
I want create a EditTemplate for byte so a drag and drop area appear there instead.
When i try to create the View with name "byte" say
Add View: The name invalid because it is a reserved name
I understand the view have to be same name as the DataType you are trying to create the template.
For example I can create an EditorTemplate for "DateTime"
So how should I Create my EditTemplate?
DateTime
is a class name, byte
is a C# reserved keyword that is an alias for System.Byte
. See the list of keywords here:
http://msdn.microsoft.com/en-us/library/x53a06bb.aspx
Change the type to Byte (instead of byte) and it should work.. if not, then you can always do this in your model:
[UIHint("ByteTemplate")]
byte[] Image {get;set;}
Then create a ByteTemplate.cshtml template.
You can also use the template selection overload of EditorFor(x => x.Image, "ByteTemplate");