Telerik Forums
UI for Blazor Forum
0 answers
204 views

Hey!

I searched everywhere but i can't find a solution for my problem.

Im using a TelerikTextBox with Telerik Blazor 2.3 but i upgraded to 3.4 and now you have to use a TelerikFloatingLabel as a parent element for the textbox.

This is my old code:

  internal static void CreateLabelTextBox(RenderTreeBuilder builder, int index, string labelContent, string propertyName, object sender, object bindObject, string className, bool isEnabled)
        {
            builder.OpenElement(index++, "Div");
            if (!string.IsNullOrEmpty(className))
            {
                builder.AddAttribute(index++, "Class", className);
            }
            builder.AddContent(index++, (RenderFragment)((rBuilder) =>
            {
                rBuilder.OpenComponent(index++, typeof(TelerikTextBox));
                if (!string.IsNullOrEmpty(labelContent))
                {
                    rBuilder.AddAttribute(index++, "Label", labelContent);
                    rBuilder.AddAttribute(index++, "Title", labelContent);
                }
                rBuilder.AddAttribute(index++, "id", GetNewId());
                if (TryGetProperty(propertyName, bindObject, out PropertyInfo property))
                {
                    var propertyValue = property.GetValue(bindObject) != null ? property.GetValue(bindObject).ToString() : string.Empty;
                    rBuilder.AddAttribute(index++, "Value", propertyValue);
                    rBuilder.AddAttribute(index++, "ValueChanged", EventCallback.Factory.Create<System.String>(sender, str => { property.SetValue(bindObject, str); }));
                }
                rBuilder.AddAttribute(index++, "Enabled", isEnabled);
                rBuilder.CloseComponent();
            }));
            builder.CloseElement();

        }

 

And now im trying to wrap this inside of a FloatingLabel:

internal static void CreateLabelTextBox(RenderTreeBuilder builder, int index, string labelContent, string propertyName, object sender, object bindObject, string className, bool isEnabled)
        {
            builder.OpenElement(index++, "Div");
            if (!string.IsNullOrEmpty(className))
            {
                builder.AddAttribute(index++, "Class", className);
            } builder.AddContent(index++, (RenderFragment)((rBuilder) =>
            {
                rBuilder.OpenComponent(index++, typeof(TelerikFloatingLabel));
                if (!string.IsNullOrEmpty(labelContent))
                {
                    rBuilder.AddAttribute(index++, "Text", labelContent);
                    //rBuilder.AddAttribute(index++, "Title", labelContent);
                }

rBuilder.AddContent(index++, (RenderFragment)((xBuilder) =>
                {
                    xBuilder.OpenComponent(index++, typeof(TelerikTextBox));
                    //if(TryGetProperty(propertyName, bindObject, out PropertyInfo property))
                    //{
                    //    var propertyValue = property.GetValue(bindObject) != null ? property.GetValue(bindObject).ToString() : string.Empty;
                    //    xBuilder.AddAttribute(index++, "bind-Value", propertyValue);
                    //}

                    xBuilder.CloseComponent();
                }));

                rBuilder.CloseComponent();
            }));
            builder.CloseElement();

}

 

Any suggestions how this might work?

                    
Philipp
Top achievements
Rank 1
 asked on 14 Jul 2022
1 answer
113 views

When AllowCreate="true", its automatically opened own appointment addDialog?. I want Stop that and want move custom page(My own page).

Please help me!

Thank You!.

 

Dimo
Telerik team
 answered on 14 Jul 2022
1 answer
250 views

I'm trying to save the CompositeFilterDescriptor.

If I do the following:

var serializedFilter = JsonSerializer.Serialize(FilterValue);
var deserializedFilter = JsonSerializer.Deserialize<CompositeFilterDescriptor>(serializedFilter);

The deserializedFilter FilterDescriptor.MemberType is null and if used causes the the display of the filters to throw an exception.

Note that the filters are part of a user preferences class that is serialized as a whole. So is there a proper way to serialize/deserialize?

Dimo
Telerik team
 answered on 14 Jul 2022
0 answers
304 views
How can I use Google maps as the provider for TelerikMap?
Ilan
Top achievements
Rank 1
Bronze
Iron
Veteran
 asked on 12 Jul 2022
1 answer
223 views

In a horizontal tab strip I would like align a single tab to the right of the tab strip.  Is this possible?

 

Dimo
Telerik team
 answered on 12 Jul 2022
0 answers
113 views
When a user clicks the back button on the web browser, especially on mobile, I'd like to close the modal and remain on the same page. Is there a way to achieve this now?
Jason
Top achievements
Rank 1
Iron
Veteran
 asked on 11 Jul 2022
0 answers
126 views

When user resizes a TileLayoutItem in a TileLayout, I am trying to detect the new RowSpan and ColSpan values using the OnResize Event.

However, it appears as if the RowSpan and ColSpan values don't update?

 

Simple Example, resize a tiled item and look at the console output (it never changes regardless of the new user-set spans):

@using Telerik.Blazor.Components

<TelerikTileLayout Reorderable="true" Resizable="true" Columns="4" ColumnWidth="200px" RowHeight="200px" 
                                 OnResize="@OnResize">
        <TileLayoutItems>
            <TileLayoutItem @ref="@_tileItem1" Id="tile1" HeaderText="Tile 1" ColSpan="1" RowSpan="1">
                <Content>Tile 1</Content>
            </TileLayoutItem>
            <TileLayoutItem @ref="@_tileItem2" Id="tile2" HeaderText="Tile 2" ColSpan="1" RowSpan="1">
                <Content>Tile 2</Content>
            </TileLayoutItem>
        </TileLayoutItems>
</TelerikTileLayout>

@code {

    private TileLayoutItem _tileItem1 = null;
    private TileLayoutItem _tileItem2 = null;

    private void OnResize(TileLayoutResizeEventArgs args)
    {
        if (args.Id == "tile1") { Console.WriteLine($"rows: {_tileItem1.RowSpan}, cols:{_tileItem1.ColSpan}"); }
        else if (args.Id == "tile2") { Console.WriteLine($"rows: {_tileItem2.RowSpan}, cols:{_tileItem2.ColSpan}"); }
    }

}

Brian
Top achievements
Rank 1
 asked on 09 Jul 2022
1 answer
906 views

When I try to set 'RefTextBox.Value = value' I get a warning:

How is the Value of a TextBox supposed to be set programmatically without binding it to a variable?

Timothy J
Top achievements
Rank 2
Bronze
Iron
Iron
 updated answer on 09 Jul 2022
0 answers
126 views
Calling SetState on a TreeList does not trigger the OnStateChanged event. I thought the whole point of the OnStateChanged event was to have a central location to capture state change actions on a TreeList? How are we supposed to capture and execute code when SetState is called to change the state of the TreeList?
Ted
Top achievements
Rank 1
Iron
Iron
 asked on 08 Jul 2022
1 answer
722 views

Hello I am trying to generate Dynamic columns for Telerik Grid it is generating multiple times columns set I want to avoid this please check bellow screen short. 

 

Here is the my code.

<TelerikGrid Data="@SearchConfigs" Resizable="true" Reorderable="true" Groupable="false">
        <GridColumns>
                @foreach (SearchConfig row in SearchConfigs)
                {
                    @foreach (var property in (IDictionary<string, string>)row.SearchFields)
                    {
                        <GridColumn Title="@property.Key">
                            <Template>
                                @property.Value
                            </Template>
                        </GridColumn>
                    }
                }
        </GridColumns>
    </TelerikGrid>

public List<SearchConfig> SearchConfigs { get; set; } = new List<SearchConfig>();

IDictionary<string, string> keyValuePairs = new Dictionary<string, string>
        {
            { "Col1", "Value1" },
            { "Col2", "Value2" },
            { "Col3", "Value3" },
            { "Col4", "Value4" },
            { "Col5", "Value5" },
            { "Col6", "Value6" },
            { "Col7", "Value7" },
            { "Col8", "Value8" },
        };

        SearchConfigs.Add(new SearchConfig { SearchFields = keyValuePairs });
        SearchConfigs.Add(new SearchConfig { SearchFields = keyValuePairs });
        SearchConfigs.Add(new SearchConfig { SearchFields = keyValuePairs });

Could you please help me figure out what is going wrong here?

 

Thank you

Jitendra
Top achievements
Rank 1
Iron
 answered on 08 Jul 2022
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?