Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
145744 | Jul 5,2019 08:59 PM UTC | Aug 9,2019 06:56 AM UTC | Blazor | 9 |
![]() |
Tags: Grid |
<EjsGrid id="Grid" @ref="@grid" ModelType="@model" AllowPaging="true" DataSource="@data" toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update" })">
<GridEditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true" Mode="EditMode.Dialog">
<Template>
@{
var employee = (context as Orders);
<table class="e-table e-inline-edit" cellspacing="0.25">
<colgroup>
<col style="width: 120px;">
<col style="width: 120px;">
</colgroup>
<tbody>
<tr>
<td style="text-align: right" class='e-rowcell'>
<input class="e-input e-field" name='Freight' value="@employee.Freight" required type="text" />
</td>
<td class='e-rowcell'>
<div class="e-input-group">
<input class="e-input e-field" name='CustomerID' value="@employee.CustomerID" required type="text" />
</div>
</td>
</tr>
</tbody>
</table>
}
</Template>
</GridEditSettings>
<GridColumns>
<GridColumn Field="OrderID" HeaderText="Order ID" IsPrimaryKey="true" TextAlign="@Syncfusion.EJ2.Blazor.Grids.TextAlign.Right" Width="90"></GridColumn>
<GridColumn Field="CustomerID" HeaderText="Customer ID" Width="90"></GridColumn>
<GridColumn Field="EmployeeID" HeaderText="Employee ID" Width="90"></GridColumn>
<GridColumn Field="Freight" HeaderText="Freight" Width="90"></GridColumn>
</GridColumns>
</EjsGrid>
………………………….
List<Orders> data;
private EjsGrid grid;
public List<Orders> order = new List<Orders>();
public Orders model = new Orders();
……………………………
|
|
<environment include="Development">
<link rel="stylesheet" rel='nofollow' href="css/bootstrap/bootstrap.min.css" />
</environment> |
<EjsGrid id="Grid" @ref="@grid" ModelType="@model" AllowPaging="true" DataSource="@data" OnActionBegin="onBegin" OnActionComplete="onComplete" toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update" })">
………………………………………………………………..
</EjsGrid>
…………………………………………
public void onBegin(object args)
{
If(args.requestType == “Add”)
{
//perform your action here while adding a record
}
If(args.requestType == “BeginEdit”)
{
//perform your action here while editing a record
}
}
|
<EjsGrid id="Grid" @ref="@grid" ModelType="@model" AllowPaging="true" DataSource="@data" OnActionBegin="onBegin" toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update" })">
<GridEditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true" Mode="EditMode.Dialog">
<Template>
@{
var employee = (context as Orders);
@if (@employee.IsAdd.ToString() == "true") {
<table class="e-table e-inline-edit" cellspacing="0.25">
<colgroup>
<col style="width: 120px;">
<col style="width: 120px;">
</colgroup>
<tbody>
<tr>
…………………………………………………
</tr>
</tbody>
</table>
}
else
{
<table class="e-table e-inline-edit" cellspacing="0.25">
<colgroup>
<col style="width: 120px;">
<col style="width: 120px;">
</colgroup>
<tbody>
<tr>
…………………………………………………
</tr>
</tbody>
</table>
}
}
</Template>
</GridEditSettings>
<GridColumns>
………………………………………….
</GridColumns>
</EjsGrid>
………………………………………………………..
public void onBegin(ActionEventArgs args)
{
if(args.RequestType.ToString() == "Add")
{
var obj = JsonConvert.DeserializeObject<Orders>(JsonConvert.SerializeObject(args.RowData));
obj.IsAdd = true;
}
} |
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.