<EjsGrid DataSource="@Orders" ModelType="@Model" Toolbar=@ToolbarItems>
...
<GridColumns>
...
<GridColumn Field=@nameof(Order.EmployeeID) HeaderText="Employee Name" ForeignKeyValue="FirstName" DataSource="@Employees" Width="150">
<EditTemplate>
<EjsDropDownList TValue="string" ID="EmployeeID" Index="0" DataSource="@Employees">
<DropDownListFieldSettings Text="FirstName" Value="EmployeeID"></DropDownListFieldSettings>
</EjsDropDownList>
</EditTemplate>
</GridColumn>
...
</GridColumns>
</EjsGrid>
|
<EjsGrid DataSource="@Orders" ModelType="@Model" Toolbar=@ToolbarItems>
<GridEvents RowSelected="RowSelected" TValue="Order"></GridEvents>
<GridColumns>
...
<GridColumn Field=@nameof(Order.EmployeeID) HeaderText="Employee Name" ForeignKeyValue="FirstName" DataSource="@Employees" Width="150">
<EditTemplate>
<EjsDropDownList TValue="string" ID="EmployeeID" Index="@DropDownIndex" DataSource="@Employees">
<DropDownListFieldSettings Text="FirstName" Value="EmployeeID"></DropDownListFieldSettings>
</EjsDropDownList>
</EditTemplate>
</GridColumn>
...
</GridColumns>
</EjsGrid>
@code{
public int? DropDownIndex;
...
public void RowSelected(RowSelectEventArgs<Order> args)
{
if(args.RowIndex == 2)
{
DropDownIndex = 0; //If and only if selected RowIndex is 2, the Index value will be 0, else it will be based on the selected RowIndex
}
else
{
DropDownIndex = Convert.ToInt32(args.RowIndex);
}
}
...
}
|
<GridColumn Field=@nameof(Order.EmployeeID) HeaderText="Employee Name" ForeignKeyValue="FirstName" DataSource="@Employees" Width="150">
<EditTemplate>
<label class="e-float-text e-label-top e-edittemplate">Employee Name</label><br>
<EjsDropDownList TValue="string" ID="EmployeeID" Index="@DropDownIndex" DataSource="@Employees">
<DropDownListFieldSettings Text="FirstName" Value="EmployeeID"></DropDownListFieldSettings>
</EjsDropDownList>
</EditTemplate>
</GridColumn>
|
<GridColumn Field=@nameof(Order.EmployeeID) HeaderText="Employee Name" ForeignKeyValue="FirstName" DataSource="@Employees" Width="150">
<EditTemplate>
@{
var Order = (context as Order);
<label class="e-float-text e-label-top e-edittemplate">Employee Name</label><br>
<EjsDropDownList ID="EmployeeID" Value="@(Order.EmployeeID)" DataSource="@Employees">
<DropDownListFieldSettings Text="FirstName" Value="EmployeeID"></DropDownListFieldSettings>
</EjsDropDownList>
}
</EditTemplate>
</GridColumn>
|