This is a migrated thread and some comments may be shown as answers.

RadImageGallery not working to display gallery

3 Answers 186 Views
ImageGallery
This is a migrated thread and some comments may be shown as answers.
Sanc
Top achievements
Rank 1
Sanc asked on 25 Apr 2016, 12:37 PM

i am using RadImageGallery under RadWindow and bind it in codebehind
this is working fine but some time not working

<telerik:RadWindow ID="rdwnShowPicture" Behaviors="Close,Move,Reload" Modal="true"
            ToolTip="Permit Detail" Width="800px" Height="600px" runat="server" VisibleStatusbar="False"
            Title="Detail" ReloadOnShow="True">
            <ContentTemplate>
                <telerik:RadImageGallery RenderMode="Lightweight" ID="RdImgGalleryPic" runat="server" Width="100%" OnNeedDataSource="RdImgGalleryPic_NeedDataSource" DataImageField="imageUrl">
                    <ImageAreaSettings Height="455px" />
                </telerik:RadImageGallery>
            </ContentTemplate>
        </telerik:RadWindow>

 

 

cs code

var imgData = (from sd in contextfct.StoreDocuments
                                   where sd.Id == tId
                                   select new { imageUrl = dv.LocationString, ContentType = dv.ContentType }).ToList();

                    DataTable dttable = new DataTable();
                    dttable.Columns.Add("imageUrl", typeof(string));
                    foreach (var it in imgData)
                    {
                        if (File.Exists(it.imageUrl))
                        {
                            byte[] bytes = File.ReadAllBytes(it.imageUrl);
                            string base64String = String.Format(@"data:" + it.ContentType + ";base64," + Convert.ToBase64String(bytes, 0, bytes.Length));
                            dttable.Rows.Add(base64String);
                        }
                    }
                    RdImgGalleryPic.DataSource = dttable;
                    RdImgGalleryPic.DataBind();
                    rdwnShowPicture.Title = "Picture";
                    rdwnShowPicture.ToolTip = "Picture";
                    string script = "function f(){$find(\"" + rdwnShowPicture.ClientID + "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);

3 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 27 Apr 2016, 12:59 PM
Hi,

Could you specify what you mean by not working some time? What exactly happen and what steps we should follow in order to replicate the problem.

Regards,
Pavlina
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Sanc
Top achievements
Rank 1
answered on 27 Apr 2016, 05:58 PM

when i upload image and save in system as file type and then show gallery in popup radwindow.

gallerty show but when again i try to upload different image and show then it will not work.

pls. help me

0
Pavlina
Telerik team
answered on 28 Apr 2016, 03:37 PM
Hello,

The provided code is not enough to determine the cause of the problem, therefore I would ask you isolate it in a runnable project in order to see why you encounter such a problem and provide a solution. It is possible the images format to be different and this to cause the issue. Another thing you should make sure is that you are not receiving any error while uploading the image second time.

Regards,
Pavlina
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
ImageGallery
Asked by
Sanc
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Sanc
Top achievements
Rank 1
Share this question
or