Problem with create Dialog size

If I create the window dialog from the selection method in the grit it doesn't work if I change the window size. However, if I use it from a button the size works perfectly. Please, could you tell me if I am doing something wrong but I do not believe this because it was generated by your code generator.

This code dosn't work
protected async System.Threading.Tasks.Task Grid0RowSelect(Agrosystem.Models.Localhost.Device args)
{
DialogService.Open($"Order 1",
new Dictionary<string, object>() { { "OrderID", 1 } },
new DialogOptions() { Width = "700px", Height = "530px", Left = "calc(50% - 350px)", Top = "calc(50% - 265px)" });
await InvokeAsync(() => { StateHasChanged(); });
}

This code work
<RadzenButton Text=@($"Show OrderID: 1 details") Click="@(args => dialogService.Open($"Order 1",
new Dictionary<string, object>() { { "OrderID", 1} },
new DialogOptions(){ Width = "800px", Height = "530px", Left = "calc(50% - 350px)", Top = "calc(50% - 265px)" }))" />

Greetings in advance and thank you

Hi @Sergio_F,

The code you are showing seems to be from an older Radzen version. Here is what Radzen generates with default settings:

var result = await DialogService.OpenAsync<EditOrder>("Edit Order", new Dictionary<string, object>() { {"Order_ID", args.Order_ID} });
await InvokeAsync(() => { StateHasChanged(); });

And here is when Width and Height are set:

var result = await DialogService.OpenAsync<EditOrder>("Edit Order", new Dictionary<string, object>() { {"Order_ID", args.Order_ID} }, new DialogOptions(){ Width = $"{800}px",Height = $"{600}px" });
await InvokeAsync(() => { StateHasChanged(); });

When We build our Project through radzen, Radzen just Renew our custom written code,

How to tackle that Custom Written Code...

thanks in advance

Hello
Pls follow the steps mentioned in Customising Code

1 Like

@Owais_Raza Don't write your custom code within the Radzen generated code.

If adding custom code to a Pages, you write the code on the *.razor.cs page not the *.razor.designer.cs page Radzen doesn't touch the *.razor.cs page

If adding custom code to a model or controller, you create a custom page so for something like ApplicationUser you would create an Application.Custom.cs class and setup a partial class to add your own partial code

Hi Korchev,
if set Height = $"{700}px" }, doesn't work , It look like maximum height is 570 px, please let me how make it work?

Thanks a lot,
Bill Zheng

Hi Korchev,
if set Height > $"{600}px" }, doesn't work , It look like maximum height is <600 px, please let me how make it work?

Thanks a lot,
Bill Zheng

The height of the dialog can definitely be more than 600px.

var dialogResult = await DialogService.OpenAsync<EditOrder>("Edit Order", 
new Dictionary<string, object>() { {"Id", args.Id} }, 
new DialogOptions(){ Height = $"{800}px" });

var dialogResult = await DialogService.OpenAsync("Edit Order",
null, new DialogOptions(){ Height = $"{800}px" });

but still doesn't work, please help !

Thanks,
Bill Zheng

Hi @BillZheng168816,

Unfortunately I cannot reproduce this problem in my tests. If you have a Radzen Professional or Enterprise subscription you can send us your project to info@radzen.com and we will troubleshoot it further.

You miss the Coponent for OpenAsync
e.g.

await DialogService.OpenAsync<DispoFahrzeugeEinzelTouren>(...

await DialogService.OpenAsync<DispoFahrzeugeEinzelTouren>("Fahrzeuge für Einzeltouren"
                                                                                         , new Dictionary<string, object>(){
                                                                                               { "anzahlsattel", AnzahlSattelEinzeltouren }
                                                                                              ,{ "anzahl3oder4achser", Anzahl3Oder4AchserEinzeltouren }
                                                                                              ,{ "anzahlsattelmax", anzahlSattelEinzeltourenMax }
                                                                                              ,{ "anzahl3oder4achsermax", anzahl3oder4AchserEinzeltourenMax }
                                                                                              ,{ "anzahleinzeltouren", AnzahlEinzeltouren }
                                                                                           }
                                                                                         , new DialogOptions(){
                                                                                                                  Width                     = $"{dimensions.Width / 3}px"
                                                                                                                , Draggable                 = false
                                                                                                                , CloseDialogOnOverlayClick = true
                                                                                                                , Resizable                 = false
                                                                                                                , ShowClose                 = false
                                                                                                              });

Hi Thomas,
What is the below ?

Thanks a lot,
Bill Zheng

Hi Thomas,

I don't need pass data by new dictionary()..
await DialogService.OpenAsync("Edit Order",
null, new DialogOptions(){ Height = $"{800}px" });

Thanks,
Bill Zheng