Jan 06, 2016, 3:16 PM
Editor Templates for Ext.Net components
Hello,
I am using MVC. Is there any way to make an editor template for an Ext.Net.TextField and some Ext.net extension method to call it? I have created a template for "string" types and returns an Ext.Net.TextField...it is expecting an MvcHtmlString...
This is my model property...
[nsSysComMod.DataAnnotations.Required]
[nsSysComMod.DataAnnotations.Display ( Name = "Data Annotation User Name" )]
[nsSysComMod.DataAnnotations.DataType ( nsSysComMod.DataAnnotations.DataType.Custom )]
public string UserName
{
get; set;
}
This is my template...
@model string
@(Ext.Net.Html.X().TextField()
.LabelAlign ( LabelAlign.Top )
.Cls( "ExtTextFieldDefault")
I am looking for extension methods in Ext.Net that will allow me to do the same as Mvc does when calling...
this.Html.EditorFor(m=>m.UserName)
This is the signature of the System.Web.Mvc.Html.EditorExtensions...
public static MvcHtmlString EditorFor<TModel, TValue> ( this HtmlHelper<TModel> html , Expression<Func<TModel , TValue>> expression );
This is the error...
cannot convert from 'System.Web.Mvc.MvcHtmlString' to 'Ext.Net.AbstractComponent'
The issue is that i am trying to add it to the "Items" collection of a FormPanel, so i need to somehow convert this MvcHtmlString to an Ext.Net component...
X.FormPanel.Items ( (this.Html.EditorFor(m=>m.UserName))
I am using MVC. Is there any way to make an editor template for an Ext.Net.TextField and some Ext.net extension method to call it? I have created a template for "string" types and returns an Ext.Net.TextField...it is expecting an MvcHtmlString...
This is my model property...
[nsSysComMod.DataAnnotations.Required]
[nsSysComMod.DataAnnotations.Display ( Name = "Data Annotation User Name" )]
[nsSysComMod.DataAnnotations.DataType ( nsSysComMod.DataAnnotations.DataType.Custom )]
public string UserName
{
get; set;
}
This is my template...
@model string
@(Ext.Net.Html.X().TextField()
.LabelAlign ( LabelAlign.Top )
.Cls( "ExtTextFieldDefault")
I am looking for extension methods in Ext.Net that will allow me to do the same as Mvc does when calling...
this.Html.EditorFor(m=>m.UserName)
This is the signature of the System.Web.Mvc.Html.EditorExtensions...
public static MvcHtmlString EditorFor<TModel, TValue> ( this HtmlHelper<TModel> html , Expression<Func<TModel , TValue>> expression );
This is the error...
cannot convert from 'System.Web.Mvc.MvcHtmlString' to 'Ext.Net.AbstractComponent'
The issue is that i am trying to add it to the "Items" collection of a FormPanel, so i need to somehow convert this MvcHtmlString to an Ext.Net component...
X.FormPanel.Items ( (this.Html.EditorFor(m=>m.UserName))
Last edited by edip; Jan 06, 2016 at 4:35 PM.