I am converting an old application that stores its images as base64strings in a SQL Server database.
I am trying to add the images to the gallery. Pointing the ImageURL to a base64 string works fine, but not the ThumbnailURL.
public static string ImageToBase64(System.Drawing.Image image, System.Drawing.Imaging.ImageFormat format)
{
string returnString = "";
System.IO.MemoryStream ms = new MemoryStream();
image.Save(ms, format);
byte[] imageBytes = ms.ToArray();
returnString = "data:image;base64," + Convert.ToBase64String(imageBytes);
return returnString;
}
public static Telerik.Web.UI.ImageGalleryItem ImageBase64(byte[] BlobData, string ImageTitle)
{
Telerik.Web.UI.ImageGalleryItem returnImage = new Telerik.Web.UI.ImageGalleryItem();
System.Drawing.Image img = null;
System.IO.MemoryStream mem = new MemoryStream();
mem.Write(BlobData, 0, BlobData.Length);
mem.Seek(0, SeekOrigin.Begin);
img = System.Drawing.Image.FromStream(mem);
returnImage.Title = ImageTitle;
returnImage.ThumbnailUrl = ImageToBase64(SizedImage(img, 100, 75), System.Drawing.Imaging.ImageFormat.Jpeg);
returnImage.ImageUrl = ImageToBase64(SizedImage(img, 800, 600), System.Drawing.Imaging.ImageFormat.Jpeg);
return returnImage;
}
returnImage.ImageUrl works perfectly fine.
public static System.Drawing.Bitmap SizedImage(System.Drawing.Image img, int dispWidth, int dispHeight)
{
double scale = 1.0, hScale = 1.0;
double imgWidth = img.Width;
double imgHeight = img.Height;
if (imgWidth > dispWidth)
scale = dispWidth / imgWidth;
if (imgHeight > dispHeight)
hScale = dispHeight / imgHeight;
if (hScale < scale)
scale = hScale;
int imgw = Convert.ToInt32(imgWidth * scale);
int imgh = Convert.ToInt32(imgHeight * scale);
return new System.Drawing.Bitmap(img, imgw, imgh);
}
<telerik:RadGrid runat="server" ID="grdImportData" RenderMode="Lightweight" AllowPaging="true" PageSize="10" OnNeedDataSource="grdImportData_NeedDataSource" OnPageIndexChanged="grdImportData_PageIndexChanged" OnUpdateCommand="grdImportData_UpdateCommand" OnDeleteCommand="grdImportData_DeleteCommand" OnItemCommand="grdImportData_ItemCommand" OnItemDataBound="grdImportData_ItemDataBound" AllowSorting="False" AlternatingItemStyle-BackColor="#f5f5f5" ItemStyle-BackColor="#ffffff" ColumnWidth="Auto" HorizontalAlignment="Stretch" Width="100%"> <ClientSettings> <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="true" FrozenColumnsCount="1" EnableVirtualScrollPaging="true"></Scrolling> <Resizing AllowColumnResize="true" ResizeGridOnColumnResize="true" EnableRealTimeResize="true" /> </ClientSettings> <MasterTableView EditMode="InPlace" DataKeyNames="Id"> <Columns> <telerik:GridEditCommandColumn HeaderStyle-Width="75px" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right"/> <telerik:GridTemplateColumn HeaderStyle-Width="50px"> <ItemTemplate> <asp:LinkButton runat="server" CommandName="Delete"><i class="icon s7-junk grid-edit-icon"></i></asp:LinkButton> </ItemTemplate> </telerik:GridTemplateColumn> </Columns> </MasterTableView></telerik:RadGrid>
I then try to add a TemplateColumn, EditTemplateColumn and RadDropdownlist programmatically like below:
protected void grdImportData_ItemDataBound(object sender, GridItemEventArgs e){ if(ImportType == "CLEARGISTIX_ASSETS") { if (e.Item is GridDataItem) { string templateColumnName = "AssetTypeName"; GridTemplateColumn templateColumn = new GridTemplateColumn(); templateColumn.ItemTemplate = new MyTemplate(templateColumnName); templateColumn.EditItemTemplate = new MyEditTemplate(); templateColumn.HeaderText = templateColumnName; templateColumn.DataField = "AssetTypeName"; if (e.Item.IsInEditMode) { RadDropDownList rddl = new RadDropDownList(); PortalView.LookupListBO list = LookupListBA.LookupList_GetByKey(DB_Context, "SITE_ASSETTYPE_LIST", UtilityBA.IsActiveChoice.Active); List<PortalView.LookupListItemBO> oList = LookupListBA.LookupListItem_GetList_ByLookupListId(DB_Context, list.LookupListId, (Guid)Current.Employee.SiteId); rddl.ID = "dropdownlist1"; rddl.DataSource = oList; rddl.DataTextField = "Name"; rddl.DataValueField = "LookupListItemId"; } grdImportData.MasterTableView.Columns.Add(templateColumn); } }}public class MyTemplate : ITemplate{ private string colname; protected Label lControl; public MyTemplate(string cName) { colname = cName; } public void InstantiateIn(System.Web.UI.Control container) { lControl = new Label(); lControl.ID = "lControl"; lControl.DataBinding += new EventHandler(lControl_DataBinding); container.Controls.Add(lControl); } public void lControl_DataBinding(object sender, EventArgs e) { Label l = (Label)sender; GridDataItem container = (GridDataItem)l.NamingContainer; l.Text = ((DataRowView)container.DataItem)[colname].ToString() + "<br />"; }}public class MyEditTemplate : IBindableTemplate{ public void InstantiateIn(Control container) { GridEditFormItem item = ((GridEditFormItem)(container.NamingContainer)); RadDropDownList drop = new RadDropDownList(); drop.ID = "dropdownlist1"; container.Controls.Add(drop); } public System.Collections.Specialized.IOrderedDictionary ExtractValues(System.Web.UI.Control container) { OrderedDictionary od = new OrderedDictionary(); od.Add("LookupListItemId", ((RadDropDownList)(((GridEditFormItem)(container)).FindControl("dropdownlist1"))).DataValueField); return od; }}
When I click on the edit button, I error: 'Unable to cast object of type 'Telerik.Web.UI.GridDataItem' to type 'Telerik.Web.UI.GridEditFormItem'.' on this line:
od.Add("LookupListItemId", ((RadDropDownList)(((GridEditFormItem)(container)).FindControl("dropdownlist1"))).DataValueField);I notice that it never his the InstaniateIn code at all.
Any assistance is greatly appreciated.

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="RadAjaxManager1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="cmbHR_DOCS_ID_START" UpdatePanelRenderMode="Inline" /> <telerik:AjaxUpdatedControl ControlID="cmbHR_DOCS_ID" UpdatePanelRenderMode="Inline" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager>$find("<%= RadAjaxManager1.ClientID %>").ajaxRequest(x);

In my project, on one of the page, the HTML rendered by RadGrid contains three HTML tables (one for header, one for data, and one for footer).
But on another page, the HTML rendered contains only one HTML table.
I can't figure out what settings are affecting the different rendering layout. Please advise.
Thanks!
We are using Telerik grid filters to display configuration dashboard for release management status. I have few Columns i.e Application, environment, location. I want to retain columns parameters after I refresh the browser.
Is there way I can retain the parameters which are coming from the database?
-

Hi Team,
I have a got paging enabled on a Radgrid, and this grid is in a web user control, this grid usercontrol is also in another user control.
when I drop the user control on an ASPX page, it works fine. but when I put grid usercontrol in another usercontrol, initial it was doing a postback and refreshing the whole page, but I bypassed that by add a RadAjaxManagerProxy which handled the AjaxUpdatedControl.
But my issue now, is that once I click on a paging page, it shows the paging page, but it it stops clicking and can't navigate to the rest of the paging page.
Any help would be appreciated
Thanks in Advance.

Hi from France !
In my project i've got problem with this situation :
I've got a radgrid, x columns.
My first column is used for generate my rowSpan.
<telerik:GridBoundColumn UniqueName="idMaille" DataField="idMaille" Display="false"></telerik:GridBoundColumn>
while idMaille is the same, Merge my gridTemplate column : "M0"
i've set Freezecolumn to 2
HTML generate is like this :
Row 1 :
<tr>
<td>FirstColumn(idMaille) not displayed</td>
<td rowspan="2">My Text rowspanned </td>
<td> next column </td>
</tr>
Row 2 :
<tr>
<td>FirstColumn(idMaille) not displayed</td>
<td> next column </td>
</tr>
But because rowspan is set in my 2nd row, my 2nd column is in reality the third !
and when i move scrollbar, javascript set "display:none"
i think this problem can it resolved if we can specify fixed columns (id/property) and generate a css class for reference for javascript.
i'm remember in old project with infragistics, we specify columns who want freeze.
<ClientSettings><Scrolling AllowScroll="true" FrozenColumnsCount="2" UseStaticHeaders="true" /></ClientSettings><MasterTableView HeaderStyle-HorizontalAlign="Center" ShowHeadersWhenNoRecords="False" > <Columns> <telerik:GridBoundColumn UniqueName="idMaille" DataField="idMaille" Display="false"></telerik:GridBoundColumn> <telerik:GridTemplateColumn UniqueName="M0"> <ItemTemplate> <div class="rw0"> test </div> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn UniqueName="M1"> <ItemTemplate> <div class="rw1"> test 1 </div> </ItemTemplate> </telerik:GridTemplateColumn> </Columns> </MasterTableView>

Hi,
Does anyone experience an issue with the menu not triggering the itemclick event.
I have recently had a forced windows 10 major update on my local development PC, but when I started to work on debugging a code, it looks like the item click event is no longer triggering.
I have the below code
AddHandler MainMenu.ItemClick, AddressOf MenuItemSelected
Then have the following eventhandler
Private Sub MenuItemSelected(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadMenuEventArgs)
But on putting a breakpoint, the eventhandler function never get triggered when I clicked on the menu,
Please let me know if I am missing something because this seems to be quite a simple code.
Thank you