While using Dialog, the code snippets from Dialog component (radzen.com) I get a build error saying -"The type or namespace name 'DialogCardPage' could not be found (are you missing a using directive or an assembly reference?) [BlazorDemo]" Since there is no mention about which namespace to be added etc. I am clueless. Any help here is appreciated. Thanks.
Maybe the entire source code will help you:
I am encountering the same issue with the DialogCardService namespace. Please, do you have any more detail about using the dialog service? I can succesfully open the simple dialog window. But this demo does not work for me because of the missing namespace:
await DialogService.OpenAsync<DialogCardPage>($"Order {orderID}",
new Dictionary<string, object>() { { "OrderID", orderID } },
new DialogOptions() { Width = "700px", Height = "512px", Resizable = true, Draggable = true });
Not sure what is DialogCardService. We have DialogCardPage in our demos, check the project for reference from my previous post.
The DialogCardPage
is just another component (not present in the example).
Try this. It should give you an idea of how it all hangs together.
Create a new class file and paste in the following -
public class Album
{
public string Artist { get; set; }
public string Title { get; set; }
}
Now create the Razor Component that will be used as the content for the dialog. Save it as 'HelloWorldDialog.razor' -
<RadzenText TextStyle="TextStyle.Caption" Text="This is a sample component dialog. The text below was passed as a parameter to the dialog via Dictionary<string, object>" />
<RadzenText TextStyle="TextStyle.Subtitle2" Text="@($"Artist - {Album.Artist}")" />
<RadzenText TextStyle="TextStyle.Subtitle2" Text="@($"Title - {Album.Title}")" />
@code {
[Parameter] public Album Album { get; set; }
}
Then, create a page to open the dialog -
<RadzenButton Text="Open dialog" Click="@OpenMyTestDialog" />
@code {
Album album = new Album() { Artist = "Roy Harper", Title = "Stormcock" };
async Task OpenMyTestDialog()
{
var dialogResult = await DialogService.OpenSideAsync<HelloWorldDialog>("Dialog Title blah blah", new Dictionary<string, object>() { { "Album", album } }, options: new SideDialogOptions { Width = "600px", CloseDialogOnOverlayClick = true, Position = DialogPosition.Right, ShowMask = true });
}
}
Notice the call - DialogService.OpenSideAsync<HelloWorldDialog>
The angled brackets contain the name of the component we are rendering in the dialog.
Stay well
Paul
Hello @Paul_Ruston .
Thank you very much for your answer.
So if I understood that correctly, the "namespace" is another page(component), which you display as the content of the dialog window. I though I just forgot to add some standardized component. Now I got it.