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. Image for the cookie policy date

Binding to Razor page model

I don't see how to bind these controls, the textbox for example, to the page model on my Razor page. 

This binds it using standard controls...
<input asp-for="Input.FirstName" class="form-control" />

How do I bind the ejs-textbox to my model?

1 Reply

NP Narayanasamy Panneer Selvam Syncfusion Team August 24, 2019 04:28 PM UTC

Hi Mike, 
 
Good day to you. 
 
We have checked your query and have prepared a sample to meet your requirement. Please refer code snippet in below 
[index.cshtml] 
@model IndexModel 
    < div id = "textbox-control" > 
        <form method="post"> 
            <ejs-textbox id="textboxfor" name="firstname" placeholder="First Name" floatLabelType="Auto" ejs-for="@Model.firstname"></ejs-textbox> 
        </form> 
</div > 
 
 
[index.cshtml.cs] 
public string firstname { get; set; } = "John"; 
 
 
For your convenience we have prepared a sample using above code, kindly get it from the below link. 
To know more about model binding in razor pages, please refer below UG link 
 
 
Please let us know if you need any further assistance on this. 
 
Regards, 
Narayanasamy P. 


Loader.
Live Chat Icon For mobile
Up arrow icon