Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
30
html helper for MaskEditor not populating value
posted

MVC3 / C# application

The following (excerpt) code is working just fine, displays the correct phone#

    @model DataRepository.StudentDataCollection
    @using Infragistics.Web.Mvc
 
    <div id="pinfoL4C1" class="s4c1">
        @Html.LabelFor(s => s.HomePhone): &nbsp;
        @Html.TextBoxFor(s => s.HomePhone) @Html.ValidationMessageFor(s => s.HomePhone, "*")
    </div>

I'd like to use the MaskEditor, so I changed my code to the following (based on the sample code)

    <div id="pinfoL4C1" class="s4c1">
        @Html.LabelFor(s => s.HomePhone): &nbsp;
        @(Html.Infragistics().MaskEditor()
                             .ID("HomePhone")
                             .Width(160)
                             .InputMask("(000) 000-0000")
                             .Required(false)
                             .ValidatorOptions(m => m.OnSubmit(false).OnChange(true).OnBlur(true).ShowIcon(true))
                             .Render())
    </div>

With the above, I have no value displaying.  

Firebug shows the following:
    <div id="pinfoL4C1" class="s4c1">
        <label for="HomePhone">HomePhone</label>
        :  
        <input id="HomePhone" class="ui-igedit-field ui-igedit ui-state-default ui-widget ui-corner-all" style="display: inline-block; width: 154px;" maxlength="19">
        <input type="hidden" name="HomePhone" value="() -">
        <script type="text/javascript">
            //<!--<![CDATA[
            $(function () {$('#HomePhone').igEditor({ type: 1, dataMode: 'alltext', width: 160, inputMask: '(000) 000-0000', required: false, validatorOptions: { onsubmit: false, onchange: true, onblur: true, showIcon: true }, inputName: 'HomePhone' });});
           //]]>-->
        </script>
    </div>

I've cleared cache, replaced the @Html.LabelFor() with literal text (just in case it was causing any confusion), and I'm not seeing my phone #.

The data value is in the format "(918) 555-1234".

I'm doing the igloader in javascript

        $(document).ready(function () {
            $.ig.loader({
                scriptPath: '../../Scripts/libs/ig/js/',
                cssPath: '../../Content/ig/css/',
                resources: 'igUpload,igCombo,igValidator,igShared',
            });
        ...

       });

Can anybody help?

Thanks,

Bruce

Parents
No Data
Reply
  • 30
    posted

    Never mind... I guess I was expecting the automatic model binding.

    - Bruce

Children
No Data