We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Get text (not value) of MaskEdit in Controller POST method

Thread ID:

Created:

Updated:

Platform:

Replies:

130505 May 16,2017 11:24 AM UTC May 18,2017 01:25 PM UTC ASP.NET Core 1
loading
Tags: MaskEdit
Gregory Perozzo
Asked On May 16, 2017 11:24 AM UTC

Hello,

I need to get MaskEdit's text in my controller method.

I can get its value using 'Parameters' as you said in Get values on postback
But I'm not able to get its text, because I want the string with the masked text and not just the pure text.

This is my MaskEdit:

<ej-mask-edit asp-for="Plate" id="maskedPlate" mask-format=">AAA-AAAA" input-mode="@InputMode.Text" />

And this is my post method:

        [HttpPost]
        [ValidateAntiForgeryToken]
        public async Task<ActionResult> Create(string maskedPlate)

Can you help me?

Karthik Ravichandran [Syncfusion]
Replied On May 18, 2017 01:25 PM UTC

Hi Gregory, 
 
Thanks for contacting Syncfusion support. 
 
We have checked your query. We have maintained the strippedValue (i.e with out mask) in the maskedit element and hidden input. So, in form post back it will return the value with out masks only. To achieve your requirement you can maintain the new hidden input and update the value in that with mask by using the method get_UnstrippedValue(). Please refer the below code block. 
 
<ej-mask-edit ej-for="@Model.inputmode" id="maskedPlate" mask-format=">AAA-AAAA" input-mode="@Syncfusion.JavaScript.InputMode.Text" create="oncreate" change="onchange"/> 
 
[script] 
function oncreate(args) { 
    var hidden = "<input type = 'hidden' id='custom" + this.element.attr('id') + "' name='" + this.element.attr('id') + "_hidden1' />" 
    this.wrapper.append(hidden) 
} 
 
function onchange(args) { 
    $('#custom'+ this.element.attr('id')).val(this.get_UnstrippedValue()); 
} 
 
[controller] 
 
public IActionResult Index(FormCollection collection) 
{ 
    string name = Request.Form["maskedPlate_hidden1"]; 
             
    return View(); 
} 
For your convenience, we have attached the sample below, 
 
 
Please let us know if you need further assistance in this. 
 
Regards, 
Karthik R 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;