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

[Solved] Mouse over a disabled RadCombo throws an exception

6 Answers 190 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 16 Jan 2008, 04:51 PM
Hi,

2nd post regarding the radCombo. One of the things I did with the non-prometheus version was to disable the combo in client side code. If I do this with the new prometheus version, I get an exception thrown in the client side script. Below this message is an example.

With the sample below, the combo is initially enabled. After resizing the radwindow, the combo is disabled. Moving the mouse over the combo throws a "Value must be a DOM element" exception.

I'm on IE7 on Windows XP (the code seems to be within a check for internet explorer)

Regards

Bobby

<%

@ Page Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<%

@ Register Assembly="RadComboBox.Net2" Namespace="Telerik.WebControls" TagPrefix="radC" %>

<%

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

<!

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<

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

<

head runat="server">

<title>Untitled Page</title>

</

head>

<

body>

<

script language="javascript" type="text/javascript" >

function

OnClientResize(sender, eventArgs)

{

RadComboBox1.Disable()

}

</

script>

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

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

<radC:RadComboBox ID="RadComboBox1" runat="server" SkinsPath="~/RadControls/ComboBox/Skins" ZIndex="90000"

Width="150px">

<Items>

<radC:RadComboBoxItem runat="server" Text="RadComboBoxItem1" />

<radC:RadComboBoxItem runat="server" Text="RadComboBoxItem2" />

<radC:RadComboBoxItem runat="server" Text="RadComboBoxItem3" />

<radC:RadComboBoxItem runat="server" Text="RadComboBoxItem4" />

<radC:RadComboBoxItem runat="server" Text="RadComboBoxItem5" />

<radC:RadComboBoxItem runat="server" Text="RadComboBoxItem6" />

<radC:RadComboBoxItem runat="server" Text="RadComboBoxItem7" />

<radC:RadComboBoxItem runat="server" Text="RadComboBoxItem8" />

<radC:RadComboBoxItem runat="server" Text="RadComboBoxItem9" />

<radC:RadComboBoxItem runat="server" Text="RadComboBoxItem10" />

<radC:RadComboBoxItem runat="server" Text="RadComboBoxItem11" />

</Items>

</radC:RadComboBox>

<div>

<telerik:RadWindowManager ID="RadWindowManager1" runat="server" OnClientResize="OnClientResize" VisibleOnPageLoad="True">

<Windows>

<telerik:RadWindow runat="server" Animation="None" Behavior="Default" Behaviors="Default"

InitialBehavior="None" InitialBehaviors="None" Left="" NavigateUrl="" Style="display: none;"

Top="">

</telerik:RadWindow>

</Windows>

</telerik:RadWindowManager>

</div>

</form>

</

body>

</

html>

6 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 17 Jan 2008, 09:34 AM
Hello Bobby,

We verified the problem. Our developers will be looking into the problem. We will be surely following up with you as soon as we have results.

Your Teleirk points have been updated for your involvement.

Regards,
Nick
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Nikolay
Telerik team
answered on 18 Jan 2008, 02:41 PM
Hi Bobby,

This is a follow up message to my last post. Our developers managed to solve the problem. At our side, it appeared that the problem arose when the treeview and the combobox resided on the same page. Attached, please find the latest build. Download it and give it a go.

If the problem persists, we will greatly appreciate a sample project of yours. You can open a new support thread, zip the files and attach the zip files to the newly started support thread.

Thanks for your time.

Expecting your reply,
Nick
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
James
Top achievements
Rank 1
answered on 21 Jan 2008, 10:29 AM
Hi,

I've extracted the files and put them in the relevant folders, but seem to be getting some oddities. Initially, it complained saying the controls couldn't be rendered. I rebooted, but now, if I flick between design/markup, i get "Duplicate component name" messages. The controls do still run though.

I can't test the comboboxes however due to a couple of problems. My code used to use the tlrkComboBoxes collection, but then I try using it, it says it's not valid. If I call the disable method, it doesn't seem to disable the combo.

I've raised a support ticket with sample code and screenshots.

Regards

Bobby
0
Nikolay
Telerik team
answered on 21 Jan 2008, 12:42 PM
Hello Bobby,

Another suggestion is to simulate the disabled behavior without actually disabling the combobox.

To disable RadComboBox I suggest that you stop the dropdown from opening .You can do that by hooking on the OnClientDropDownOpening event and use set_cancel(true) in its event handler.

For an example:
<telerik:RadComboBox DataTextField="CompanyName" DataValueField="CompanyName" OnItemsRequested="RadComboBox1_ItemsRequested" 
                                EnableLoadOnDemand="True" ID="RadComboBox1" runat="server"  EnableScreenBoundaryDetection=false Width="150px" 
                                Skin="Mac" CustomDisabled="true" OnClientDropDownOpening ="OnClientDropDownOpening" SelectedValue='<%#Bind("CompanyName") %>' DataSourceID="SessionDataSource2">  
                            </telerik:RadComboBox> 

    <script type="text/javascript">  
            function OnClientDropDownOpening(sender,e)  
            {  
                  
                e.set_cancel(true);  
            }  
</script> 

Also, you can set some custom attribute to RadComboBox.For an exmaple -CustomDisabled. Then, you can include some javascript code overriding the default behavior of RadComboBox when CustomDisabled is true.

See the following code -
<asp:ScriptManager ID="ScriptManager1"  runat="server" > 
        <Scripts> 
            <asp:ScriptReference Path="ClientEventTest.js" /> 
                 </Scripts> 
</asp:ScriptManager> 
where ClientEventTest.js is:
// Hook up Application event handlers.  
var app = Sys.Application;  
app.add_init(ApplicationInit);  
 
 
// Application event handlers for component developers.  
function ApplicationInit(sender) {  
   
    Telerik.Web.UI.RadComboBox.prototype._onInputClick = function ()  
     {  
         if (!this.get_attributes().getAttribute("CutstomDisabled"))  
         {  
            if (this._enabled)  
            {  
                this._selectFirstMatch();  
                this.selectText(0, this.get_text().length);  
                if (!this.get_dropDownVisible()&& this._showDropDownOnTextboxClick)  
                {  
                    this.showDropDown();  
                }  
                return true;  
            }  
         }  
     }  
       
    Telerik.Web.UI.RadComboBox.prototype._onFocus = function (e)  
     {   
         if(!this.get_attributes().getAttribute("CutstomDisabled"))  
         {  
            if (this._focused)  
                return;  
            var table = this.get_tableElement();  
            if(table!=null)  
            {  
                table.className =  "rcbFocused";  
            }             
            if (!e) e = event;  
              
            this._focused = true;  
              
            this.raise_onClientFocus();  
            return true;  
        }  
    }  
      
}  
 

Let us know if this helps.


Regards,
Nick
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
James
Top achievements
Rank 1
answered on 22 Jan 2008, 02:01 PM
Hi Again,

I'm back onto trying this again, but am still having problems, and so cant yet test the cancelling combo dropdown suggestion.

In design, with the hotfix version. I still get the item displayed with an error saying "Duplicate component name". This only started when i put the hotfix one on.

My application also failed due to it not finding the "tlrkComboBoxes". Has this been removed, and if so, how can I access the combo box items. (They are within a radToolbar control)

One thing I noticed on your example, which I'm not sure if it's a typo. You are accessing an attribute called "CutstomDisabled". Should it be "CustomDisabled"?

Regards

Bobby
0
James
Top achievements
Rank 1
answered on 22 Jan 2008, 03:07 PM
Making some progress :-)

I've now reverted the dll's back to the pre-hotfix version. the tlrkComboBoxes works as it used to. I've now removed the ".disable" code and implemented event handlers to cancel the dropdown for each combo as required.

Functionally, this is working fine. Next step is to see if I can change the combo appearance on the fly to make it appear disabled.

Thanks for the suggestion and sample code Nick.
Tags
ComboBox
Asked by
James
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
James
Top achievements
Rank 1
Share this question
or