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

Images lost with UpdatePanel

2 Answers 85 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Robert Enestedt
Top achievements
Rank 1
Robert Enestedt asked on 12 Feb 2009, 11:27 AM
Hi

I have a RadComboBox populated from Page_Load with countries and flags inside an UpdatePanel. They display correctly on first load, but after a postback all images become broken links. I have tried using both the standard asp UpdatePanel and the telerik RadAjaxPanel but both give the same behavior. Any solution to this?

Forgive me if this was answered somewhere else, I looked but couldn't find it.

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 13 Feb 2009, 07:14 AM
Hi Robert,

I tried the scenario and I found it working fine on my end (RadControl Product version 2008.03.1314.20). Could you please share with us more details about your scenario if it is different from mine? Take a look at the code which I tried to achieve this.

CS:
protected void Page_Load(object sender, EventArgs e) 
    if (!IsPostBack) 
    { 
        RadComboBoxItem comboItem1 = new RadComboBoxItem("Country1"); 
        comboItem1.ImageUrl = "../Image/flag2.gif"
        RadComboBoxItem comboItem2 = new RadComboBoxItem("Country2"); 
        comboItem2.ImageUrl = "../Image/flag1.gif"
        RadComboBox1.Items.Add(comboItem1); 
        RadComboBox1.Items.Add(comboItem2); 
        RadComboBox1.DataBind(); 
    } 

ASPX:
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" height="200px"  
    width="300px"
    <telerik:RadComboBox ID="RadComboBox1" Runat="server"
    </telerik:RadComboBox> 
</telerik:RadAjaxPanel> 

Thanks,
Shinu.
0
Robert Enestedt
Top achievements
Rank 1
answered on 13 Feb 2009, 08:48 AM
protected void Page_Load(object sender, EventArgs e) 
        { 
            if (!Page.IsPostBack) 
            { 
                PopulateCurrencyDropDown(); 
            }             
        } 
 
protected void PopulateCurrencyDropDown() 
        { 
            CurrencyData[] rates = GetRatesWrapper(); 
 
            foreach (CurrencyData cd in rates) 
            { 
 
                RadComboBoxItem rcbi = new RadComboBoxItem(); 
                rcbi.Value = cd.CurrencyCode; 
                rcbi.Text = cd.Country + ", " + cd.CurrencyCode; 
                    rcbi.ImageUrl = "~/gfx/flags_small/" + cd.CountryCode.ToLower() + ".gif"
                RadComboBox1.Items.Add(rcbi); 
            }           
CS

<telerik:RadAjaxPanel runat="server" ID="rapPanel"
<telerik:RadComboBox ID="RadComboBox1" Skin="Gray" runat="server" Width="180" Height="300" AutoPostBack="true"
</telerik:RadComboBox> 
</telerik:RadAjaxPanel> 
 
ASPX



I can't even get this simple example to work in my environment (both IE7 and FF). I noticed you had an DataBind() that I didn't so I added that but it doesn't make any difference sadly. I'm using 2008.3.1409.35 and ASP.NET 3.5.

The items remain but the images all break after any async postback. I had a more complex scenario than the above where the postback actually did something, but that didn't work either.

Thank you
Tags
ComboBox
Asked by
Robert Enestedt
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Robert Enestedt
Top achievements
Rank 1
Share this question
or