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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to define properties for FOR controls?

Description

While creating FOR controls, you have to define the properties in the View model when unobtrusive is in the enabled mode.

Solution

While creating FOR controls in the MVC application, when the unobtrusive is disabled, you can define the properties of your components in the builder itself, as shown in the following code example.

CSHTML

When the unobtrusive is in the enabled state, you have to define the properties of your components in the model. You have to define the DatePicker model in the builder as shown in the following code example.

CSHTML

Using that object you can set the value of the properties as shown in the following code example.

Controller

  public ActionResult Index()

  {

        Incident inc =new Incident();

        inc.datepicker1 =System.DateTime.Now;

        DatePickerProperties datemodel = new DatePickerProperties();

        datemodel.Locale = "en-GB";

        datemodel.ShowOtherMonths = false;

        ViewData["date"] = datemodel;

   return View(inc);

  }

Similarly you can access all the properties and events of your components from the controller when the unobtrusive is enabled state.

You can download the complete sample under the following location.

Sample Location:

Sample

Article ID: Published Date: Last Revised Date: Platform: Control:
4670 04/22/2015 04/22/2015 ASP.NET MVC DatePicker
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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