vcsharp
  • Posts: 81
  • Joined: 03/10/2017
Steps to reproduce this issue.

1. On Edit Profile page select a country like United States or any other country. One can see flag images in this step.

2.After step 1, ajax postback occurs and after the request finishes, open the Country drop down and you will see that images are missing.

A video of this issue can be seen at Video of this Issue 
Sponsor
vcsharp
  • Posts: 81
  • Joined: 03/10/2017
I was able to resolve this issue. All that was needed was to set the property ImageLocation property of Country ImageListBox. This property was set in code-behind when EditProfile page first loaded in BindData( ) method, but it is not being persisted across postbacks. So when Country drop down makes an ajax postback, in the Render method of ImageListBox.cs control, this property is blank.

So, I set it in markup for this control in controls/EditUserProfile.ascx user control and then on ajax postback the images for countries are still visible. I have tested and tried this code.


       <td class="post">
            <YAF:ImageListBox ID="Country" AutoPostBack="true" 
                        OnTextChanged="LookForNewRegions" runat="server" 
                       CssClass="selectMenuWithIcons" 
                       ImageLocation="/Content/images/flags/{0}.png"/>
        </td>


But, I think a better option would be to persist the property ImageLocation in ImageListBox control by using sample code as below. I have tested this code also and it works. This will take care of regular as well as ajax postbacks from ImageListBox on all pages unlike the first solution that will work only on a single page.

Code change in ImageListBox.cs in YAF.Controls project

        public string ImageLocation
        {
            get
            {
                string imageLocation = ViewState["ListBoxImageLocation"] as string;
                return string.IsNullOrWhiteSpace(imageLocation) ? string.Empty : imageLocation;
            }
            set
            {
                ViewState["ListBoxImageLocation"] = value;
            }
        }

tha_watcha
  • Posts: 4083
  • Joined: 06/03/2010
Thanks issue will be fixed in the next release.
UserPostedImage
Forum Jump  
  • You cannot post new topics in this forum.
  • You cannot reply to topics in this forum.
  • You cannot delete your posts in this forum.
  • You cannot edit your posts in this forum.
  • You cannot create polls in this forum.
  • You cannot vote in polls in this forum.

About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button

Project Twitter Updates

Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved