We have the RadImageGallery implemented on page. The code behind loads up one or more images by reading in an array of bytes from each file. Occasionally, an exception is thrown when one of those images is invalid (corrupt or some other issue). OK, that's fine, but we would like to trap the exception and handle the error in a particular way. But... we don't seem to be able to trap it other than in our last-chance global exception handler.
The binary data is created in the NeedDataSource event, and that returns successfully. I've added other events and set breakpoints in each of them, and they all return ok. So, is there an event we can handle that would be appropriate for a simple try/catch block?
Pretty simple markup for the RadImageGallery control (note, all the events after the OnNeedDataSource were added simply to test out if there was a place we could try/catch the exception, but no exception was thrown in those events):
<telerik:RadImageGallery ID="galleryImages" runat="server" RenderMode="Lightweight"
DisplayAreaMode="Image" LoopItems="true" DataImageField="ImageBytes" DataDescriptionField="Description" DataTitleField="Title"
OnNeedDataSource="galleryImages_NeedDataSource"
OnDataBinding="galleryImages_DataBinding"
OnImageRequested="galleryImages_ImageRequested"
OnItemCreated="galleryImages_ItemCreated"
OnPreRender="galleryImages_PreRender">
</telerik:RadImageGallery>
Code behind for NeedDataSource (which returns successfully):
protected void galleryImages_NeedDataSource(object sender, Telerik.Web.UI.ImageGalleryNeedDataSourceEventArgs e)
{
galleryImages.Visible = false;
FileManager fileManager = new FileManager ();
DataTable dt = fileManager.GetFileList();
var imageFiles = fileManager.GetGalleryImages(dt);
if (imageFiles.Count() == 0)
{
txtNotes.Text = "There are no image files to display.";
return;
}
try
{
galleryImages.DataSource = imageFiles;
galleryImages.Visible = true;
}
catch (Exception ex)
{
LogException(ex);
ErrorMessage("An unexpected occurred while reading one or more the image files");
}
if (fileManager.HasErrors)
{
txtErrors.Text = "The following errors were encountered:<br/><ul>" + String.Join("<li>", fileManager.ErrorList) + "</ul>";
}
}
Library code that reads image files into byte arrays (also return successfully):
public List<GalleryImage> GetGalleryImages(DataTable srcDataTable)
{
//...
foreach (DataRow dr in query)
{
CustomImageFile f = new CustomImageFile(dr);
try
{
byte[] byteArray = File.ReadAllBytes(f.FullFileName);
GalleryImage img = new GalleryImage
{
ImageBytes = byteArray,
Description = $"{f.Description}", // [{f.Name}]
};
imageList.Add(img);
}
catch (Exception ex)
{
Errors.Add($"{f.Name} could not be read");
LogException(ex);
}
}
return imageList;
}
Yet when there is an invalid file encountered, we get this:
[ArgumentException: Parameter is not valid.]
System.Drawing.Image.FromStream(Stream stream, Boolean useEmbeddedColorManagement, Boolean validateImageData) +1162080
Telerik.Web.UI.BinaryImageFormatHelper.CreateImgFromBytes(Byte[] data) +69
[ArgumentException: The provided binary data may not be valid image or may contains unknown header]
Telerik.Web.UI.BinaryImageFormatHelper.CreateImgFromBytes(Byte[] data) +120
Telerik.Web.UI.BinaryImageTransformationFilter.ProcessImageInternal(Byte[] image) +44
Telerik.Web.UI.BinaryImageTransformationFilter.ProcessImage(Byte[] image) +20
Telerik.Web.UI.BinaryImageFilterProcessor.ProcessFilters(Byte[] imageData) +112
Telerik.Web.UI.RadBinaryImage.ProcessImageData() +57
Telerik.Web.UI.RadBinaryImage.OnPreRender(EventArgs e) +20
System.Web.UI.Control.PreRenderRecursiveInternal() +90
System.Web.UI.Control.PreRenderRecursiveInternal() +163
Hello,
Is Editor support both rtl and ltr modes for editor content? For ex. Is it possible to create a table with 2 columns, where left column content is ltr on english and right column is rtl on arabic?
For a while I found only separate examples and not found rtl/ltr buttons in the Editor.
If you have a page with Telerik UI for ASP.NET AJAX RadHtmlChart and try to add Kendo UI for jQuery Notification to that page...
The JavaScript:
var notif = jqueryobject.kendoNotification({appendTo: "#appendto"}).data("kendoNotification");
You cannot call notif.show() because notif is undefined.
We added a kendoNotification to our skin and on pages that use Telerik UI for ASP.NET AJAX RadHtmlChart causes this problem. Other pages with other Telerik UI for ASP.NET AJAX controls work fine.
We have also seen this issue on one other Telerik UI for ASP.NET AJAX control: RadClientDataSource
Any work-around to get this working?
https://demos.telerik.com/aspnet-ajax/grid/examples/columns-rows/rows/drag-and-drop/defaultcs.aspx
This demo doesnt work - is there a working version?
Is it possible in radgrid to allow a collapsed group to be selected by row and then drag and drop to new grid and all the collapsed rows under the group are dropped?
Recently I've been expressing some weird behavior with the MultiSelect displaying and extra dropdown next to the control (see attached image). This is just standard markup, nothing fancy. Is there a property setting I'm missing?
Thanks for any help you can provide.
<telerik:RadMultiSelect ID="msLOB" runat="server" Width="100%" Filter="StartsWith" Placeholder="Select LOB" DataTextField="text" DataValueField="value" Skin="Silk" RenderMode="Lightweight">
<Items>
<telerik:MultiSelectItem Text="All" Value="All" Selected="false"></telerik:MultiSelectItem>
<telerik:MultiSelectItem Text="Commercial-Large" Value="Commercial-Large" Selected="false"</telerik:MultiSelectItem>
<telerik:MultiSelectItem Text="Commercial-Small" Value="Commercial-Small" Selected="false"></telerik:MultiSelectItem>
<telerik:MultiSelectItem Text="Commercial-Individual" Value="Commercial-Individual" Selected="false">
</telerik:MultiSelectItem>
<telerik:MultiSelectItem Text="Medicare-MAPD" Value="Medicare-MAPD" Selected="false"></telerik:MultiSelectItem>
</Items>
</telerik:RadMultiSelect>
Hi,
I have an HTML form and a RadGrid configured on a page. RadGrid's events and all the properties are dynamically built on the server side. RadGrid has an ExportToExcel toolbar command and works as it is. The issue is when I click the ExportToExcel toolbar button, It downloads the Excel file. When I click the HTML form's Save button, which means input type submit button, Radgrid downloads the Excel file again. If I click a different Radgrid toolbar command and then click the Form submit button, Radgrid will trigger its previous toolbar event.
Thanks
Hi,
I'm testing the PDF Signature demo shown in this Telerik example PDF Signature demo. The issue I'm having is I cannot pull a pdf that resides on a network file server where we store all common files. I have no issues loading a pdf on my localhost machine.
From what I can tell, the issue appears to be the third party opensource pdf.js file Telerik is using in demo that seems confined to only load pdf's from directories within the web application and it's sub-folders defined in IIS for the website. Also, the network file server is used everywhere within our web application so it's not a security issue.
The error I get from pdf.js is "Not allowed to load local resource" which results in page prompt "PDF file fails to process." display.
We have an existing web.config entry that looks like this:
<add key="AttachmentsShare" value="\\my_file_server\file"/>
I've tried calling the file server a few different ways with no luck.
RadPdfViewer1.PdfjsProcessingSettings.File = ConfigurationManager.AppSettings("AttachmentsShare") & "1234.pdf"
RadPdfViewer1.PdfjsProcessingSettings.FileSettings.Url = ConfigurationManager.AppSettings("AttachmentsShare") & "1234.pdf"
Please advise. Thanks.