RadImageGallery not working to display gallery

4 posts, 0 answers
  1. Sanc
    Sanc avatar
    2 posts
    Member since:
    Dec 2014

    Posted 25 Apr Link to this post

    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);

  2. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 27 Apr Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sanc
    Sanc avatar
    2 posts
    Member since:
    Dec 2014

    Posted 27 Apr in reply to Pavlina Link to this post

    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

  5. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 28 Apr Link to this post

    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.
Back to Top