<EjsButton ID="btn" Onclick="click">Change</EjsButton>
<EjsGrid id="Grid" ref="@grid" AllowPaging="true" Query="new ej.data.Query().addParams('code',10)">
<EjsDataManager Url="api/Default" Adaptor="Adaptors.WebApiAdaptor"></EjsDataManager>
<GridColumns>
<GridColumn Field="OrderID" HeaderText="Order ID" ISPrimaryKey="true" TextAlign="@Syncfusion.EJ2.RazorComponents.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>
@functions{
EjsGrid grid { get; set; }
protected override void OnInit()
{
}
public void click(UIMouseEventArgs args)
{
//update the Grid query and rebind to Grid.
grid.Query = "new ej.data.Query().addParams('code',5)";
grid.DataBind();
}
} |
public object Get()
{
BindDataSource();
var data = order.AsQueryable();
var count = order.Count;
var queryString = Request.Query;
if (queryString.Keys.Contains("$inlinecount"))
{
StringValues Skip;
string Code = HttpUtility.ParseQueryString(Request.QueryString.Value).Get("code");
int skip = (queryString.TryGetValue("$skip", out Skip)) ? Convert.ToInt32(Skip[0]) : 0;
int top = Convert.ToInt32(Code);
return new { Items = data.Skip(skip).Take(top), Count = count };
}
else
{
return data;
}
// return new { Items = order.AsQueryable(), Count = order.Count };
} |
|
|
<EjsButton ID="btn" Onclick="click">Change</EjsButton>
<EjsGrid id="Grid" @ref="grid" AllowPaging="true" Query="new ej.data.Query().addParams('code',10)">
<EjsDataManager Url="api/Default" Adaptor="Adaptors.WebApiAdaptor"></EjsDataManager>
<GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true"></GridEditSettings>
<GridColumns>
……………………………………………………………
</GridColumns>
</EjsGrid>
@code{
private EjsGrid grid;
public void click(UIMouseEventArgs args)
{
//update the Grid query and rebind to Grid.
this.grid.Query = "new ej.data.Query().addParams('code',5)";
this.grid.DataBind();
this.grid.Refresh();
}
} |
<EjsCalendar ValueChange="OnChange"></EjsCalendar>
<EjsGrid TValue="Orders" Query="@($"new ej.data.Query().addParams('month',{Val})")" AllowPaging="true">
<EjsDataManager Url="api/Default" Adaptor="Adaptors.WebApiAdaptor"></EjsDataManager>
. . . . . . . . . . . . .. .
</EjsGrid>
@code{
public string Val = "092019";
public void OnChange(ChangedEventArgs args)
{
Val = "12345";
}
} |