col.Field(r => r.Symbol).Format("<a class='symbol'>{Symbol}</a>").Add();In the Create event for the grid I have the following code:
col.Field(r => r.StartDate).Add();
col.Field(r => r.EndDate).Add();
<Grid>
@(Html.EJ().Grid<object>
("FlatGrid")
.Datasource(ds => ds.Json((IEnumerable<object>)ViewBag.datasource))
.AllowScrolling()
.AllowPaging() /*Paging Enabled*/
. . .
.ClientSideEvents(e=>e.RecordClick("recordClick"))
.Columns(col =>
{
col.Field("ID").HeaderText("ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();
col.Field("Email").HeaderText("Email").Width(80).Add();
col.Field("Symbol").HeaderText("Symbol").Format("<a class='symbol'>{Symbol}</a>").TextAlign(TextAlign.Right).Width(75).Add();
col.Field("startDate").HeaderText("startDate").TextAlign(TextAlign.Right).Width(75).Add();
col.Field("EndDate").HeaderText("EndDate").ForeignKeyField("Status").TextAlign(TextAlign.Right).Width(75).Add();
}))
<Dialog>
@{Html.EJ().Dialog("basicDialog").Title("Dialog").Containment(".control").ContentTemplate(
@<div>
<h1>My Test</h1>
<div class="cnt">
Test content
</div>
StartDate:<br>
<input type="text" id="startDate"><br><br>
EndDate:<br>
<input type="text" id="EndDate"><br>
</div>).Width(550).MinWidth(315).MinHeight(215).IsResponsive(true).ShowOnInit(false).ClientSideEvents(evt => evt.Close("onDialogClose")).Render();}
Note: The Dialog was open by default when initialization. We can stop the default dialog rendering on initialization using ShowOnInit property.
<RecordClick event>
function recordClick(args) {
var startDate = args.data.startDate; // Get the value of start date
var EndDate = args.data.EndDate; // Get the value of end date
if (args.cell.find('a').hasClass("symbol")) {
$("#basicDialog").ejDialog("open"); // Open the Dialog
$("#startDate").val(startDate); // Set the value of start date
$("#EndDate").val(EndDate);//Set the value of End date
}
} |