[CLOSED] Adding a Convert handler to a ModelField created dynamically

  1. #1

    [CLOSED] Adding a Convert handler to a ModelField created dynamically

    I am generating a datastore in my C# codebehind that looks kind of like this:
    <ext:Store ID="stor1" runat="server" DataSourceID="sds1">
        <Model>
            <ext:Model runat="server" ID = "modlData" IDProperty = "StudentSeatLabel" >
                <Fields>
                    <ext:ModelField Name="StudentSeatLabel" />
                    <ext:ModelField Name="StudentSeatLabelLength" Type="Int" />
                    <ext:ModelField Name="StudentSeatLabelSort" Type="String" >
                        <Convert Handler="return getSortableSeatNumber(record)" />
                    </ext:ModelField>
                </Fields>
            </ext:Model>
    </ext:Store>
    The first two fields are easy:
                this.stor1.Model.Clear();
                this.stor1.Model.Add(new Model { ID = "modlData", IDProperty = "StudentSeatLabel" });
                this.stor1.Model[0].Fields.Add(new ModelField("StudentSeatLabel"));
                this.stor1.Model[0].Fields.Add(new ModelField.Config { Name = "StudentSeatLabelLength", Type = ModelFieldType.Int });
                this.stor1.Model[0].Fields.Add(new ModelField.Config { Name = "StudentSeatLabelSort", Type = ModelFieldType.Int });
    However when I try to set the Convert property I am told it is read only. How can I configure this dynamic store to match the markup previously listed. (I am using Ext.net 2.5)

    Thanks in advance.
    Last edited by Daniil; Sep 27, 2014 at 7:25 AM. Reason: [CLOSED]
  2. #2
    Hi @tnwheeler,

    It is how you can initialize read-only properties.
    Example
    new ModelField 
    {
        Name = "Name",
        Convert =
        {
            Handler = "return 'something';"    
        }   
    }
  3. #3
    Thanks @Daniil !


    That worked like a charm.

Similar Threads

  1. [CLOSED] ModelField useNull when populating from HTTP handler
    By cwolcott in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: May 12, 2014, 4:11 PM
  2. [CLOSED] Adding aspx Gridpanel to dynamically created tab
    By ASAPCH in forum 2.x Legacy Premium Help
    Replies: 7
    Last Post: Dec 06, 2012, 2:47 PM
  3. [CLOSED] Adding a dynamically created textfield below fileuploadfield
    By wisdomchuck in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: May 29, 2012, 4:09 PM
  4. [CLOSED] Convert Handler in xmlreader
    By 78fede78 in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Oct 25, 2010, 11:30 AM
  5. [CLOSED] add handler to dynamically created combobox/textbox
    By Hari_CSC in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: May 11, 2010, 8:51 AM

Tags for this Thread

Posting Permissions