using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream($"ClaimForms.Server.Shared.Images.{logoFile}.png")) { ImageSource imageSource = new ImageSource(stream, ImageQuality.High); CurrentEditor.DrawImage(imageSource, new Size(162, 42)); }
I'm using a collection of tabs to display PDF files. For example, I have two tabs open and the current document is scrolled to about mid document. Now I add a new document in a new tab. The new document and all others will scroll to the same spot as the previously active tab. I'd like to retain the position of documents in any open tabs while having the document in the new tab open to the top of the first page.
If I have multiple tabs open and documents scrolled to various positions they do not change simply switching from tab to tab. The change only occurs when adding a new tab.
I have a Blazor server solution with separate projects for the UI and API. When the Upload component is configured to use a controller in the API project to handle the save function I get the error seen in the attached file 'Screenshot 2025-02-26 132709' but the file is successfully uploaded. If I copy the same controller to the UI project the error goes away see 'Screenshot 2025-02-26 132538'.
to get the save function to work with the API at all I had to add the below HTTP options section to the API program.cs
app.Use(async (context, next) => { if (context.Request.Method == HttpMethods.Options) { context.Response.Headers.Add("Allow", "GET, POST, PUT, OPTIONS"); context.Response.Headers.Add("Access-Control-Allow-Origin", "https://localhost:7053"); context.Response.StatusCode = (int)HttpStatusCode.OK; return; } await next.Invoke(); });
Upload component:
<TelerikUpload SaveUrl="@saveURL"
RemoveUrl="https://localhost:7121/api/DocumentUpload/remove"
MaxFileSize="@MaxFileSize"
/>
Controller:
using DocumentFormat.OpenXml.Drawing;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace API.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class DocumentUploadController : ControllerBase
{
public IWebHostEnvironment HostingEnvironment { get; set; }
public DocumentUploadController(IWebHostEnvironment hostingEnvironment)
{
HostingEnvironment = hostingEnvironment;
}
[HttpPost("save")]
public async Task<IActionResult> Save(IFormFile files) // "files" matches the Upload SaveField value
{
if (files != null)
{
try
{
// save to wwwroot - Blazor Server only
//var rootPath = HostingEnvironment.WebRootPath;
// save to Server project root - Blazor Server or WebAssembly
var rootPath = HostingEnvironment.ContentRootPath;
var newFolder = Guid.NewGuid().ToString();
System.IO.Directory.CreateDirectory(rootPath + newFolder);
var saveLocation = System.IO.Path.Combine(rootPath + newFolder, files.FileName);
using (var fileStream = new FileStream(saveLocation, FileMode.Create))
{
await files.CopyToAsync(fileStream);
}
}
catch (Exception ex)
{
Response.StatusCode = 500;
await Response.WriteAsync($"Upload failed.");
}
}
return new OkResult();
}
[HttpPost("remove")]
public async Task<IActionResult> Remove([FromForm] string files) // "files" matches the Upload RemoveField value
{
if (files != null)
{
try
{
// delete from wwwroot - Blazor Server only
var rootPath = HostingEnvironment.WebRootPath;
// delete from Server project root - Blazor Server or WebAssembly
//var rootPath = HostingEnvironment.ContentRootPath;
var fileLocation = System.IO.Path.Combine(rootPath, files);
if (System.IO.File.Exists(fileLocation))
{
System.IO.File.Delete(fileLocation);
}
}
catch (Exception ex)
{
Response.StatusCode = 500;
await Response.WriteAsync($"Delete failed.");
}
}
return new EmptyResult();
}
}
}
Any ideas? Have I missed something I need to setup in the API program.cs?
I am having a weird Problem. When the scroll bar gets involved my tasks are not lined up with left side of the gnatt chart. This doesn't seem to be a problem if I return the same items but return less roles.
I have tried to mess with the CSS. I saw something about this being an issue when height is 100%. I have heigh set to 91vh.
I am at loss. Any suggestions?
Hi!
FileSelect, when used with large files, slows down the upload speed.
In my case, when going from 10MB to 100MB, upload speed goes from 2MB/s down to 300KB/s. I'm uploading into a MemoryStream with an initial capacity of the size of the file, in order to avoid reallocations.
Best fit for the upload time in seconds, given the file size in MB seems to be:
There seems O(n^2) complexity hidden somewhere. Does anyone know what's going on?
When using the Bootstrap theme with the scheduler, appointments are cutting off the bottoms of the Day Number in the cell. Is there an easy way to add a margin to the first appointment in each day cell so that all of the appointments in the cell shift down and don't overlap the number? Here's a repl of what it currently looks like:
https://blazorrepl.telerik.com/mJkQmEvU03c6KHyg35
Thanks,
Mike
Hello, i want use the treeview, i have many elements. so it stretch if i expand it over the screen, and this is not fine :)
so i want the treeview in the dropdown list. but it doestn work. it looks horrible. Have someone a idea or a soution. thank you.
this is my code. and i need a treeview. because i have expand items.
<TelerikDropDownList Data="@FlatData" @bind-Value="SelectedItemText" >EDIT: Title should say *Can't* enable/disable DropDownList rather than *Can*
I have a Dialog component with a DropDownList and a MultiSelect. When no items are selected in the MultiSelect, I want the DropDownList to be disabled. I've set it up like so:
<TelerikDropDownList Data="@Data" @bind-Value="@SelectedValue" Enabled="@IsEnabled"/>
<TelerikMultiSelect Data="@SelectData"
TextField="Text"
ValueField="TheValue"
OnChange="@SelectChange"
@bind-Value="@SelectValue"/>
@code {
public class MyData
{
public string Text { get; set; }
public string TheValue { get; set; }
}
private string @SelectedValue { get; set; } = "One";
private List<string> Data { get; set; } =
[
"One",
"Two",
"Three"
];
private List<MyData> SelectData { get; set; } =
[
new MyData { Text = "One", TheValue = "1" },
new MyData { Text = "Two", TheValue = "2" },
new MyData { Text = "Three", TheValue = "3" }
];
private List<string> SelectValue { get; set; } = [];
private bool IsEnabled = false;
private void SelectChange()
{
IsEnabled = SelectValue.Count > 0;
}
}
When I put the DropDownList and MultiSelect directly into a Dialog, this doesn't work. Specifically, when I add items to the MultiSelect, the DropDownList doesn't get enabled. However, when I move this exact same code into a separate component and then embed THAT component into the Dialog, then it does. Any ideas why that would be?
I have a reproduction of the issue here: https://github.com/kbaley/TelerikBlazor/blob/main/TelerikBlazor/TelerikBlazor.Client/Pages/Home.razor
EDIT: I've tried calling StateHasChanged in the SelectChange handler but it doesn't change the behaviour.
Is there a way to set a default title when a day is clicked to add new event in the Telerik Scheduler? And to set the IsAllDay to true by default? I only need to do this when calendar is double-clicked to add new event.
Thanks,
Toya
I'm trying to use the Telerik and Kendo UI Accessibility Utilities in my Blazor application.
I've followed the instructions at https://www.telerik.com/design-system/docs/utils/get-started/installation/ to install the npm package, it I'm unclear how to access this from my Blazor application.
Looks like I need to add a stylesheet link, but I can't figure out the syntax.