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

[Solved] Combobox does not load properly

1 Answer 178 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Vaibhav
Top achievements
Rank 1
Vaibhav asked on 13 Feb 2008, 02:03 PM
Hi ,

  I have two update panel , one having button and another having place holder. when I click button and  load control  dynamically in other update panel place holder, the skin of the of the combobox does not get loaded properly.
If  I do not place the button in the update panel then evrything works fine. but in my application I have to use two update panel so I cannot think of removing the update panel.

Thanks & Regards,

Vaibhav Goel



the Code which I am using is as below

ASPX:

<%

@ Page Language="C#" AutoEventWireup="true" CodeFile="DynamicLoadControl.aspx.cs" Inherits="DynamicLoadControl" %>

<%

@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<!

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<

html xmlns="http://www.w3.org/1999/xhtml" >

<

head runat="server">

<title>Untitled Page</title>

</

head>

<

body>

<form id="form1" runat="server">

<asp:ScriptManager ID="ScriptManager" runat="server"></asp:ScriptManager>

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">

<ContentTemplate>

<div>

<asp:Button id="cmdLoadControl" runat="server" OnClick="cmdLoadControl_Click" Text="Load Control 1" />

</div>

</ContentTemplate>

</asp:UpdatePanel>

<table cellpadding="0" cellspacing="0" style="height: 100%; background-color: white;

border-top-width: thin; border-left-width: thin; border-left-color: black; border-bottom-width: thin;

border-bottom-color: black; border-top-color: black; border-right-width: thin;

border-right-color: black; width: 100%; position: static;"

width="100%">

<tr>

<td>

<asp:UpdatePanel id="pnluCompanyData" runat="server" UpdateMode="Conditional">

<contenttemplate>

<asp:PlaceHolder id="CtrlPlaceholder" runat="server">

</asp:PlaceHolder>

</contenttemplate>

</asp:UpdatePanel>

</td>

</tr>

</table>

</form>

</

body>

</

html>




ASPX.CS

using

System;

using

System.Data;

using

System.Configuration;

using

System.Collections;

using

System.Web;

using

System.Web.Security;

using

System.Web.UI;

using

System.Web.UI.WebControls;

using

System.Web.UI.WebControls.WebParts;

using

System.Web.UI.HtmlControls;

public

partial class DynamicLoadControl : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

}

protected void cmdLoadControl_Click(object sender, EventArgs e)

{

CtrlPlaceholder.Controls.Clear();

Control cntDynamicControl = LoadControl("DynamicControl.ascx");

cntDynamicControl.ID =

"DynamicControl";

CtrlPlaceholder.Controls.Add(cntDynamicControl);

pnluCompanyData.Update();

}

}



ASCX

<%

@ Control Language="C#" AutoEventWireup="true" CodeFile="DynamicControl.ascx.cs" Inherits="DynamicControl" %>

<%

@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<

telerik:RadComboBox id="drpEvaluationMonth" runat="server"

AutoPostBack="True" >

<Items >

<telerik:RadComboBoxItem runat="server" Text="1" />

<telerik:RadComboBoxItem runat="server" Text="2" />

<telerik:RadComboBoxItem runat="server" Text="3" />

<telerik:RadComboBoxItem runat="server" Text="4" />

<telerik:RadComboBoxItem runat="server" Text="5" />

<telerik:RadComboBoxItem runat="server" Text="6" />

</Items>

<CollapseAnimation Duration="200" Type="OutQuint" />

<ExpandAnimation Type="OutQuart" />

</

telerik:RadComboBox>

1 Answer, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 14 Feb 2008, 03:09 PM
Hello Vaibhav,

The styles of an initially invisible RadComboBox are not registered on the page. MS Update Panel does not registers them as well, after a callback request is made, so you should link them manually in the <head> section of the page like this:

<link href="~/[PATH]/ComboBox.Default.css" rel="Stylesheet" type="text/css" /> 

Here, [PATH] should be replaced with the location of the .css file, relative to the project directory.

I hope this helps.

Greetings,
Simeon
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
ComboBox
Asked by
Vaibhav
Top achievements
Rank 1
Answers by
Simon
Telerik team
Share this question
or