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

Rating Control In The Grid

Thread ID:





125131 Jul 23,2016 07:24 PM UTC Jul 26,2016 09:29 AM UTC ASP.NET MVC 1
Tags: Grid
Jeffrey Stone
Asked On July 23, 2016 07:24 PM UTC

How can I use Rating control in a ASP NET MVC Grid Column?

Regards, Jeff

Karthick Kuppusamy [Syncfusion]
Replied On July 26, 2016 09:29 AM UTC

Hi Jeffrey,   
Thanks for contacting Syncfusion support.   
We can render the ejRating control through ‘Edit Template’ feature of the Grid.   
Edit Template has three functions.   
Create – It is used to create the control at the time of initializing.  
Read –  It is used to read the input value at the time of saving.  
Write – It is used to assign the value to control at the time of editing 
Please refer to the below code example for further details.   
.Columns(col =>   
            col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();   
            col.Field("CustomerID").HeaderText("Customer ID").Width(80).Add();   
            col.Field("EmployeeID").HeaderText("Rating").EditTemplate(a => { a.Create("create").Read("read").Write("write"); }).TextAlign(TextAlign.Right).Width(175).Add();   
            col.Field("ShipCity").HeaderText("Ship City").Width(110).Add();   
  <script type="text/javascript">     
              function create() {   
                  return $("<input>"); // Create the input element   
    function write(args) {   
        var gridId = args.element.parents(".e-grid").attr("id");   
        args.element.ejRating({ value: args.rowdata !== undefined ? args.rowdata["EmployeeID"] : "", modelType: "picker" }); // Render the rating control   
        $("#" + gridId + "Color_Presets").css("display", "none");   
    function read(args) {   
        var a = $("#FlatGridEmployeeID").ejRating("instance");   
        return a.getValue(); // Read the rating value   
Please refer to the below UG Documentation and online demo link to know more about EditTemplate in Grid.   
We have created a sample which can be downloaded from the below link.   
If we have misunderstood your requirement, please share more details about your requirement.   
K. Karthick  


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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