Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
145429 | Jun 21,2019 08:47 AM UTC | Jul 3,2019 01:58 PM UTC | ASP.NET MVC - EJ 2 | 5 |
![]() |
Tags: Grid |
Hi, I have create a .cs function to ecnrypt and decrypt parameter value that is pass thru rel='nofollow' href link.
For value that is pass using from data grid based on click details for each row, we use this kind of syntax (ex: ${DocNumber}). I can't figure out how to pass the value in my function because it makes the syntax wrong for rel='nofollow' href link. please find below my code for better understanding.
Not a valid syntax
usually, for hardcoded value, i just wrote the syntax as per below
onclick="location.rel='nofollow' href='/CTS/ScoringReport?IN_OUT=OUT&mode=@Common.Encrypt("SEA", true)'
so, the question is, how to pass dynamic value( ${anyvaluefromgrid}) to the link inside my method Common.Encrypt?
thanks,
afiq
<div>
@Html.EJS().Grid("Grid").DataSource((IEnumerable<object>)ViewBag.dataSource).Columns(col =>
{
col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).Width("120").ValidationRules(new { required = true }).TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
col.Field("CustomerID").HeaderText("Customer Name").Width("150").ValidationRules(new { required = true, minLength = 3 }).Add();
col.Field("ShipName").HeaderText("Ship Name").Width("150").Add();
col.Field("ShipCountry").HeaderText("Ship Country").Width("150").EditType("dropdownedit").Add();
col.HeaderText("Row ID").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Center).Template("#template").Width("150").Add();
}).AllowPaging().PageSettings(page => page.PageSize(8)).EditSettings(edit => { edit.AllowAdding(true).AllowEditing(true).AllowDeleting(true).Mode(Syncfusion.EJ2.Grids.EditMode.Normal); }).Toolbar(new List<string>() { "Add", "Edit", "Delete", "Update", "Cancel" }).Render()
</div>
<script id="template" type="text/x-template">
</script>
<script>
function getDetail(e, a) {
var gridIns = document.getElementById("Grid").ej2_instances[0];
var encrptData = gridIns.getRowInfo(e.target).rowData.OrderID * 2;
a.rel='nofollow' href += encrptData;
}
</script> |
<div>
@Html.EJS().Grid("Grid").DataSource((IEnumerable<object>)ViewBag.dataSource).Columns(col =>
{
col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).Width("120").ValidationRules(new { required = true }).TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
. . . .
col.HeaderText("Row ID").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Center).Template("#template").Width("150").Add();
}).AllowPaging().PageSettings(page => page.PageSize(8)).EditSettings(edit => { edit.AllowAdding(true).AllowEditing(true).AllowDeleting(true).Mode(Syncfusion.EJ2.Grids.EditMode.Normal); }).Toolbar(new List<string>() { "Add", "Edit", "Delete", "Update", "Cancel" }).Render()
</div>
<script id="template" type="text/x-template">
<a rel='nofollow' href="${upperCase(data.CustomerID)}">Hello</a>
</script>
<script>
function upperCase(str) {
return str.toLowerCase();
}
</script>
|
<script id="template" type="text/x-template">
</script>
|
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.
This page will automatically be redirected to the sign-in page in 10 seconds.