Product Bundles
DevCraft
All Telerik .NET and Kendo UI JavaScript components and AI Tools in one package.
Kendo UI
Bundle of AI Tools plus four JavaScript UI libraries built natively for jQuery, Angular, React and Vue.
Telerik
Build great .NET business apps
Net Web
Cross-Platform
Desktop
Reporting and Documents
Testing & Mocking
Debugging
Build JavaScript UI
Javascript
AI for Developers & IT
Ensure AI program success
AI Coding
Additional Tools
Enhance the developer and designer experience
UI/UX Tools
Free Tools
CMS
Support and Learning
Docs & Resources
Productivity and Design Tools
I would like to style the drop down list in the editor template and maybe the checkbox elements in a grid. Is this possible at the moment?
Thanks,
Kenny
You can cascade through the grid classes. Here follows an example I made for you with the key points highlighted. It showcases:
Note that browsers tend to disallow styling of checkboxes so most rules you put for them will be ignored.
Example:
@
using
Telerik.Blazor.Components.Grid
<style>
.specialEditorsAppearance .myOwnClass {
border: 1px solid red;
}
.specialEditorsAppearance .k-grid-table input[type=
'checkbox'
],
.specialEditorsAppearance .k-grid-table select {
margin: 50px !important;
</style>
<TelerikGrid Data=@MyData EditMode=
"inline"
Pageable=
"true"
Class=
"specialEditorsAppearance"
>
<TelerikGridColumns>
<TelerikGridColumn Field=@nameof(SampleData.ID) Title=
"ID"
/>
<TelerikGridColumn Field=@nameof(SampleData.Name) Title=
"Name"
<TelerikGridColumn Field=@nameof(SampleData.OnLeave) Title=
"On Leave?"
<TelerikGridColumn Field=@nameof(SampleData.Role) Title=
"Position"
<EditorTemplate>
@{
CurrentlyEditedEmployee = context
as
SampleData;
<select
class
=
"myOwnClass"
bind=@CurrentlyEditedEmployee.Role>
foreach
(
string
item
in
Roles)
{
<option value=@item>@item</option>
</select>
</EditorTemplate>
</TelerikGridColumn>
<TelerikGridCommandColumn>
<TelerikGridCommandButton Command=
"Save"
Icon=
"save"
ShowInEdit=
>Update</TelerikGridCommandButton>
"Edit"
"edit"
>Edit</TelerikGridCommandButton>
</TelerikGridCommandColumn>
</TelerikGridColumns>
<TelerikGridEvents>
<EventsManager OnUpdate=
"@UpdateHandler"
></EventsManager>
</TelerikGridEvents>
</TelerikGrid>
@functions {
public
SampleData CurrentlyEditedEmployee {
get
;
set
; }
void
UpdateHandler(GridCommandEventArgs args)
SampleData item = (SampleData)args.Item;
//perform actual data source operations here
//if you have a context added through an @inject statement, you could call its SaveChanges() method
//myContext.SaveChanges();
var matchingItem = MyData.FirstOrDefault(c => c.ID == item.ID);
if
(matchingItem !=
null
)
matchingItem.Name = item.Name;
matchingItem.Role = item.Role;
protected
override
OnInit()
MyData =
new
List<SampleData>();
for
int
i = 0; i < 50; i++)
MyData.Add(
SampleData()
ID = i,
Name =
"name "
+ i,
Role = Roles[i % Roles.Count]
});
//in a real case, keep the models in dedicated locations, this is just an easy to copy and see example
SampleData
ID {
Name {
bool
OnLeave {
Role {
List<SampleData> MyData {
static
List<
> Roles =
> {
"Manager"
,
"Employee"
"Contractor"
};