|
<Template>
@{
var employee = (context as EmployeeData);
<div class="form-group col-md-6">
<SfDropDownList ID="StockProductName" TItem="EmployeeData" @bind-Value="employee.FirstName" TValue="string" DataSource="@Employees" FloatLabelType="Syncfusion.Blazor.Inputs.FloatLabelType.Always" Placeholder="Product">
<DropDownListFieldSettings Value="EmployeeID" Text="FirstName"></DropDownListFieldSettings>
<DropDownListEvents TItem="EmployeeData" TValue="string" ValueChange="OnProductChange"></DropDownListEvents>
</SfDropDownList>
</div>
<div class="form-group col-md-6">
<SfNumericTextBox ID="QuantityAvailable" TValue="double?" @bind-Value="@NumericValue" @ref="QttyAvailable" FloatLabelType="FloatLabelType.Always"></SfNumericTextBox>
</div>
}
</Template>
public double? NumericValue { get; set; }
public void OnProductChange(Syncfusion.Blazor.DropDowns.ChangeEventArgs<string, EmployeeData> args)
{
//var product = args.ItemData;
//selling.QuantityRemaining = product.QuantityAvailable;
//StateHasChanged();
var product = args.ItemData;
NumericValue = product.EmployeeID;
//selling.QuantityAvailable = product.QuantityAvailable;
//QttyAvailable.Value = product.QuantityAvailable;
//SellPrice.Value = product.ProductSellingPrice;
//sal.ProductSellingPrice = product.ProductSellingPrice;
//this.StateHasChanged();
}
|
|
<SfGrid @ref="Grid" DataSource="@GridData" Toolbar="@(new string[] {"Add", "Edit","Delete","Update","Cancel" })">
<GridEvents TValue="OrdersDetails" OnActionComplete="ActionComplete"></GridEvents>
<GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true"Mode="@EditMode.Dialog">
<Template>
@{
var Order = (context as OrdersDetails);
<div>
<div class="form-row">
<div class="form-group col-md-6">
<label class="e-float-text e-label-top">Order ID</label>
<SfNumericTextBox ID="OrderID" @bind-Value="@(Order.OrderID)"Enabled="@((Order.OrderID == null) ? true : false)"></SfNumericTextBox>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label class="e-float-text e-label-top">Freight</label>
@{
Order.Freight = IsFreightModified ? Freight : Order.Freight;
IsFreightModified = false;
}
<SfNumericTextBox @ref="Numeric" ID="Freight" @bind-Value="@(Order.Freight)"TValue="double?"></SfNumericTextBox>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label class="e-float-text e-label-top">Ship Country</label>
<SfDropDownList ID="ShipCountry" @bind-Value="@(Order.ShipCountry)"TItem="OrdersDetails" TValue="string" DataSource="@GridData">
<DropDownListFieldSettings Value="ShipCountry" Text="ShipCountry"></DropDownListFieldSettings>
<DropDownListEvents TItem="OrdersDetails" TValue="string" ValueChange="OnChange"></DropDownListEvents>
</SfDropDownList>
</div>
</div>
</div>
}
</Template>
</GridEditSettings>
..
..
</SfGrid>
@code{
SfNumericTextBox<double?> Numeric { get; set; }
public double? Freight { get; set; }
public bool IsFreightModified { get; set; }
public SfGrid<OrdersDetails> Grid { get; set; }
public void ActionComplete(ActionEventArgs<OrdersDetails> args)
{
if (args.RequestType.Equals(Syncfusion.Blazor.Grids.Action.Add) || args.RequestType.Equals(Syncfusion.Blazor.Grids.Action.BeginEdit))
{
Grid.PreventRender(false);
}
}
public void OnChange(Syncfusion.Blazor.DropDowns.ChangeEventArgs<string, OrdersDetails> args)
{
IsFreightModified = true;
Freight = args.ItemData.Freight + 1;
}
} |