Editor Templates for Ext.Net components

  1. #1

    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))
    Last edited by edip; Jan 06, 2016 at 4:35 PM.

Similar Threads

  1. [CLOSED] MVC Templates
    By adelaney in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Aug 16, 2012, 5:04 PM
  2. [CLOSED] Combo with Templates and Ajax
    By deejayns in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Dec 02, 2011, 1:22 PM
  3. Templates column in gridpanel
    By hernanjls in forum 1.x Help
    Replies: 0
    Last Post: Aug 13, 2009, 4:47 PM
  4. Complex Serialization and Templates
    By BrunoC in forum 1.x Help
    Replies: 1
    Last Post: Jan 30, 2009, 1:18 PM
  5. [CLOSED] Overriding Button Templates
    By UGRev in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Dec 12, 2008, 12:36 PM

Tags for this Thread

Posting Permissions