Telerik Forums
UI for Blazor Forum
2 answers
639 views

Hello,

Is it possible to use the UI for Blazor within a Razor class library?

We have a project where we need to have multiple reusable component libraries that will ideally be based on UI for Blazor, in our current tests we add the nuget package to the Razor class library and it fails to be recognised when trying to consume the namespaces. Also we need to share the App between Server and Client Blazor, once again requiring the UI for Blazor to be with a shared razor library.

Thanks,

Andy.

Andy
Top achievements
Rank 1
 answered on 03 Mar 2020
2 answers
239 views

Hi,

 

I am trying to run a blazor server side component inside a razor view page.

 

So the razor view is this:

 

<div class="wrapper">
 
    @await Html.PartialAsync("_farmMenu", new PfmsWeb.Areas.Shared.ActiveMenu("PickupSequence"))
 
    <div id="main" class="sidebar-page main">
        <component type="@typeof(PfmsWeb.Components.Harvest.PickupSequence.PickupSequenceShell)" render-mode="ServerPrerendered"/>
    </div>
</div>

 

And the PickupSequenceShell.razor file looks like this:

 

<TelerikRootComponent>
Shell Started
<br/>
<Counter/>
</TelerikRootComponent>

 

However, when running the application the counter is not rendered at all. If I reference the counter directly from the razor view it does work. There must something in my understanding that is stopping this from working properly. It cannot be the blazor js as like I said I can run the counter directly from the razor view.

This is a very large application so I cannot easily just bring the entire thing into blazor server side, I have to host little blazor server side apps inside the razor views refactoring parts of the application as I go.

Has anyone managed to get a hybrid app working on dotnet core with controllers and views?

 

Marin Bratanov
Telerik team
 answered on 03 Mar 2020
1 answer
725 views

Hi there,

I need the same fuctionality of the "Add" command of the grid's toolbar but using a button located anywhere in the page. Is this possible?

 

<GridToolBar>
   <GridCommandButton Command="Add" Icon="add">Add Item</GridCommandButton>
</GridToolBar>

Thank you.

Svetoslav Dimitrov
Telerik team
 answered on 02 Mar 2020
1 answer
639 views

We are evaluation the blazor controls from telerik and would like to know few things.

1. Is it possible to implement fluent validation as part of the object validation as done here? https://blog.stevensanderson.com/2019/09/04/blazor-fluentvalidation/

I tried doing this but it would not catch the validation

 

  <EditForm Model="@selectedBuildingModel" OnValidSubmit="@Save">
            <FluentValidator TValidator="BuildingModelValidator" />
            <div class="form-row">
                <div class="col">
                    <TelerikTextBox @bind-Value="@selectedBuildingModel.Name" Label="First Name"></TelerikTextBox>
                    <ValidationMessage For="@(() => selectedBuildingModel.Name)" />
                </div>

            </div>

            <div class="form-row">
                <ValidationSummary />
                <TelerikButton Icon="save" Primary="true" ButtonType="@ButtonType.Submit">Save</TelerikButton>
                <TelerikButton Icon="cancel" OnClick="@ClearSelection" ButtonType="@ButtonType.Button">Cancel</TelerikButton>
            </div>
        </EditForm>

  public class BuildingModelValidator : AbstractValidator<BuildingModel>
    {
        public BuildingModelValidator()
        {
            RuleFor(x => x.Name).NotEmpty().MaximumLength(5);
        }
    }

2. When will the upload control be available (even if its insiders, we just wanna see how it works)?

 

Thank you

Marin Bratanov
Telerik team
 answered on 02 Mar 2020
9 answers
750 views

Is there a way to set a password char on the blazor textbox?

Thanks … Ed

 

Marin Bratanov
Telerik team
 answered on 02 Mar 2020
2 answers
7.1K+ views
I can add the button, but I need to be able to identify the row that the button was on in the @onclick event so that I can pop-up a form with information specific to that row.
Dan
Top achievements
Rank 1
 answered on 26 Feb 2020
2 answers
1.7K+ views

I have just tested Telerik sample code from :

https://demos.telerik.com/blazor-ui/dropdownlist/overview

@page "/dropdownlist/overview"
@page "/dropdownlist/index"

@using TelerikBlazorDemos.Shared

<div class="example-box-wrapper">
    <div class="example">
        <div class="mb-4">T-Shirt size:</div>
        <TelerikDropDownList Data="@Data"
                             @bind-Value=@SelectedSizeMetric
                             PopupHeight=""
                             DefaultText="Select your T-shirt size"
                             ValueField="SizeMetric" TextField="SizeText">
        </TelerikDropDownList>
    </div>

    <div class="ml-4">
        Selected Size Number: <strong>@SelectedSizeMetric</strong>
    </div>
</div>

@code  {
    public IEnumerable<Size> Data { get; set; }
    public bool AllowCustom { get; set; } = true;
    public int? SelectedSizeMetric { get; set; }
    public string SelectedSize { get; set; }

    public class Size
    {
        public string SizeText { get; set; }
        public int? SizeMetric { get; set; }
    }

    protected override void OnInitialized()
    {
        List<Size> sizes = new List<Size>();

        sizes.Add(new Size()
        {
            SizeText = "X-Small",
            SizeMetric = 3
        });

        sizes.Add(new Size()
        {
            SizeText = "Small",
            SizeMetric = 6
        });

        sizes.Add(new Size()
        {
            SizeText = "Medium",
            SizeMetric = 8
        });

        sizes.Add(new Size()
        {
            SizeText = "Large",
            SizeMetric = 10
        });

        sizes.Add(new Size()
        {
            SizeText = "X-Large",
            SizeMetric = 12
        });

        Data = sizes.AsQueryable();
        base.OnInitialized();
    }
}

 

It works fine as it is.

But if I change:

ValueField="SizeMetric" //int type
for:
ValueField="SizeText" //string type

it nolonger works... I get: System.InvalidCastException : 'Unable to cast object of type 'System.String' to type 'System.Nullable`1[System.Int32]'.'

 

The telerik doc (https://docs.telerik.com/blazor-ui/components/dropdownlist/overview) specifies:

The Value and ValueField can be of types:
number (such as int, double and so on)
string
Guid
Enum

 

 


A
Top achievements
Rank 1
 answered on 24 Feb 2020
2 answers
202 views

I have added Component in <TelerikGrid>/<GridColumn>/<Template>. Grid is loading based on data in a text field. All columns are getting update except column having component.

 

<GridColumns>
        <GridColumn Field="@(nameof(Fee.FEE_ID))" Title="STD">
            <Template>
                @{
                    Fee Fee = context as Fee;
                    <RTP_SMS.Pages.Components.CompStdNN id="@Fee.FEE_ID"></RTP_SMS.Pages.Components.CompStdNN>
                }
            </Template>
        </GridColumn>
 </GridColumns>

 

Atif
Top achievements
Rank 1
 answered on 24 Feb 2020
4 answers
654 views
Hello,
i wanted to know if you are planning on making chipslist component for ui for blazor or not ? 
and the most important feature for a chips list is the ability to add the written word to selected items list with a simple hit on enter key 
so is it gonna be able to work smoothly ?
 
Marin Bratanov
Telerik team
 answered on 23 Feb 2020
1 answer
4.5K+ views

I am using the DataSourceRequest.ToODataString() but the resulting request to my OData is case sensitive. I have seen examples of the $filter clause that uses the OData tolower method to give case-insensitive search.

 

For example, the following calls to me ASP.NET Core 3.1 / Microsoft.AspNetCore.Odata v7.3.0 API all return the same result set; 

https://myapi/v1/accounts?$filter=contains(tolower(AccountName),tolower('eng'))&$top=2&$skip=0&$count=true

https://myapi/v1/accounts?$filter=contains(tolower(AccountName),tolower('Eng'))&$top=2&$skip=0&$count=true

https://myapi/v1/accounts?$filter=contains(tolower(AccountName),tolower('eNg'))&$top=2&$skip=0&$count=true

Is there a way to modify your DataSourceRequest.ToODataString to support this type of client site modification so I can use it to do case-insensitive filters?

 

 

 

Marin Bratanov
Telerik team
 answered on 21 Feb 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?