Hi
I have a problem with disabled dropdown color. If I disable the dropdown from server side using Office2007 Skin then color goes gray which is good but if I disable the control using javascript then color stay white. I cannot change the skin as my entire application is configured to use that color scheme so I have not tested it on other skins but overall the color should go gray either we disable it using Server Side code or JS code.
The other problem is I am unable to find the Dropdown in JS using
document.getElementById or $find or $get
one of them returns object and others null, the object one gives error that this is not its property.
Now I have attached the OnClientLoad event and either stores the object in global js variable or doing initial settings there.
I have tried different options posted on telerik forum to find dropdown but all invain.
I would like to upload the mini project with problems but could not find any upload option here. Please paste this code and test it at your end.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<%@ 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></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager runat="server" ID="smTest"></asp:ScriptManager>
<div>
<p>Disabled color from Server side</p><telerik:RadComboBox ID="RadComboBox1" runat="server" >
<Items>
<telerik:RadComboBoxItem Text="This is disabled from Server end" />
<telerik:RadComboBoxItem Text="Another text 1" />
</Items>
</telerik:RadComboBox>
<p>Disabled from Client Side</p><telerik:RadComboBox ID="RadComboBox2" runat="server" OnClientLoad="ClientLoad">
<Items>
<telerik:RadComboBoxItem Text="Disable from Client Side" />
<telerik:RadComboBoxItem Text="Another text" />
</Items>
</telerik:RadComboBox>
<input type="button" onclick="return disableClientControl()" value="why Cant I get the dropdown" />
</div>
<script language="javascript" type="text/javascript">
var ddl1;
function ClientLoad(sender, args) {
ddl1 = sender;
ddl1.set_enabled(false);
}
function disableClientControl() {
var ddl = document.getElementById("RadComboBox2")
alert("next line will give JS error")
ddl.set_enabled(false);
}
</script>
</form>
</body>
</html>
-------------
SERVER SIDE CODE
------------
protected void Page_Load(object sender, EventArgs e)
{
RadComboBox1.Enabled = false;
}
I have a problem with disabled dropdown color. If I disable the dropdown from server side using Office2007 Skin then color goes gray which is good but if I disable the control using javascript then color stay white. I cannot change the skin as my entire application is configured to use that color scheme so I have not tested it on other skins but overall the color should go gray either we disable it using Server Side code or JS code.
The other problem is I am unable to find the Dropdown in JS using
document.getElementById or $find or $get
one of them returns object and others null, the object one gives error that this is not its property.
Now I have attached the OnClientLoad event and either stores the object in global js variable or doing initial settings there.
I have tried different options posted on telerik forum to find dropdown but all invain.
I would like to upload the mini project with problems but could not find any upload option here. Please paste this code and test it at your end.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<%@ 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></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager runat="server" ID="smTest"></asp:ScriptManager>
<div>
<p>Disabled color from Server side</p><telerik:RadComboBox ID="RadComboBox1" runat="server" >
<Items>
<telerik:RadComboBoxItem Text="This is disabled from Server end" />
<telerik:RadComboBoxItem Text="Another text 1" />
</Items>
</telerik:RadComboBox>
<p>Disabled from Client Side</p><telerik:RadComboBox ID="RadComboBox2" runat="server" OnClientLoad="ClientLoad">
<Items>
<telerik:RadComboBoxItem Text="Disable from Client Side" />
<telerik:RadComboBoxItem Text="Another text" />
</Items>
</telerik:RadComboBox>
<input type="button" onclick="return disableClientControl()" value="why Cant I get the dropdown" />
</div>
<script language="javascript" type="text/javascript">
var ddl1;
function ClientLoad(sender, args) {
ddl1 = sender;
ddl1.set_enabled(false);
}
function disableClientControl() {
var ddl = document.getElementById("RadComboBox2")
alert("next line will give JS error")
ddl.set_enabled(false);
}
</script>
</form>
</body>
</html>
-------------
SERVER SIDE CODE
------------
protected void Page_Load(object sender, EventArgs e)
{
RadComboBox1.Enabled = false;
}