Ringo
January 8, 2025, 6:27pm
1
Hello,
I have a question for the Radzen.Blazor File and directory browser (RadzenTree). Is it possible to open a file from the server with the component?
Is there a URL property or a Download function?
I tryed to to set a HTML Link into the TreeExpandEventArgs children.Text but the HTML don't work. The text is shown raw:
nodeText = "<a href="W3Schools Online Web Tutorials ">Visit W3Schools.com!";
Is it possible to open a (PDF) file?
Regards Ringo
enchev
January 8, 2025, 6:42pm
2
This thread might help you:
Atanas,
I got the controller to work with the data from the db.
When i post this from a form all works as expected and the PDF apears as it should . Now i want to call this from a button in a datagrid. I have almost got it to works but not quite.
[image]
When i click the yellow button in my datagrid it routes correctly to the controller and it returns but I do not get the PDF.
[Inject]
NavigationManager navigationManager { get; set; }
public async Task P…
Ringo
January 13, 2025, 3:06pm
3
I got a solution. No controller, no special download method, just a href link which I set in this method. It works fine:
private RenderFragment<RadzenTreeItem> TreeItemTemplate => context => __builder =>
{
@if (IsFile(context.Value))
{
<RadzenIcon Icon="insert_drive_file" />
<p><a href="@GetUrlForNode(context.Value)" target="=_blank"><b>@context.Text.Substring(4)</b></a></p>
}
else
In this methode it works to format the content.
Now I have a further problem with updating files. If the files are already in the development project the link works. If I put a new file on the server the tree has the file, the link will be generated correctly but an error occurs when opening:
The error:
The file is there. The url ist correct. The rights should be ok but it cannot be downloaded!
Ist there a setting to allow to download the added or updated files?
Regards
Ringo
enchev
January 13, 2025, 3:30pm
4
I’m afraid that I’ve never seen such error before and I don’t know how to solve it.