How to customize my column under ejs grid

Hi Syncfusion support

I want to customize my column under ejs grid to enable user to click to controller and the same time pass the primary id for action.
I using ej2 syncfusion. attach the details for your attention.

Thanks

Attachment: ej2issues1_35cf19b4.rar

1 Reply

MF Mohammed Farook J Syncfusion Team October 5, 2018 11:52 AM UTC

Hi Haryzad, 
 
Thanks for contacting Syncfusion support. 
 
From your code snippet , we  found that you have passed the selected value through queryString. So we can get the queryString value from the server by using ‘HttpContext.Request.QueryString’. Please find the code example and sample for your reference. 
 
 
Client side: 
 
<ejs-grid id="Grid" dataSource=@ViewBag.DataSource> 
    <e-grid-columns> 
 
              .... 
 
        <e-grid-column field="EmployeeID" headerText="Employee ID" template="#colTemplate" width="130"></e-grid-column> 
   </e-grid-columns> 
</ejs-grid> 
 
<script type="text/x-jsrender" id="colTemplate"> 
    <a id="${EmployeeID}" onclick="check(${ EmployeeID })">${EmployeeID}</a> 
</script> 
 
 
<script type="text/javascript"> 
    function check(args) { 
        $("#" + args).attr("rel='nofollow' href", "/Home/Percent/?EmployeeID" + args// pass the queryString 
    } 
</script> 
 
 
Controller side: 
 
public string Percent() 
        { 
            string str = HttpContext.Request.QueryString.Value.Split("EmployeeID")[1];  // get the queryString value 
            return str; 
        } 
 
Screenshot: 
 
 
Refer the following sample for further assistance, 
 
 
Regards, 
J Mohammed Farook. 
 


Loader.
Up arrow icon