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

Event When Highlighting an Item

4 Answers 75 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
kencox
Top achievements
Rank 1
kencox asked on 31 Dec 2009, 07:28 AM
Is there a way to get an event when the user scrolls from one combobox item to another? I know there are events when the user selects an item, but what about when the highlight comes on?
I'd like to display some additional data related to the item that is highlighted.

Thanks,

Ken

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 31 Dec 2009, 08:39 AM
Hi Ken,

You can attach mouseover event to the items in the combobox and then display corresponding data accordingly. Checkout the example below.

cs:

 
    protected void RadComboBox1_Load(object sender, EventArgs e) 
    { 
        foreach (RadComboBoxItem item in RadComboBox1.Items) 
        { 
            item.Attributes.Add("onmouseover""itemMouseover('"+item.Text+"')"); 
        } 
    } 

javascript:
 
    function itemMouseover(text) { 
        var lbl = document.getElementById("Label1"); 
        lbl.innerHTML = text; 
    } 

Happy New Year!  :)
Shinu.
0
VitorBarao
Top achievements
Rank 1
answered on 02 Sep 2011, 10:03 AM
I was having the same question, and stumble upon this thread.

But I could not help to notice: This Guru takes 5 minutes of his time on a new year's eve, answers the question correctly, whishes him a happy new year and not even a "Thank you" :)

Thanks Shinu!
0
David Samson
Top achievements
Rank 1
answered on 13 Mar 2014, 11:52 AM
Hi,

I've the same requirement but the difference is.

I have two RadComboBoxes on the bases of 1st combo box's selection I am filling 2nd combo box and I have to display title (attribute: title) of the 2nd combo box item to asp:label.

It is working fine but when I am not selecting anything and simply hovering on 2nd combo box and then returning to change 1st combo box's value it is giving me error. I have attached that screenshot for your understanding purpose.

Is there anything I am doing wrong?

Below is my code:

HTML::
<telerik:RadComboBox ID="rcbQue4" MaxHeight="200px" ExpandDirection="down" EnableVirtualScrolling="true"
    runat="server" Width="205px" AutoPostBack="true" OnSelectedIndexChanged="rcbQue4_SelectedIndexChanged"
    OnClientDropDownOpening="rcbQue4_OnClientDropDownOpening"></telerik:RadComboBox>
<telerik:RadComboBox ID="rcbQue5" Enabled="false" MaxHeight="200px" ExpandDirection="down" EnableVirtualScrolling="true"
    runat="server" Width="205px" AutoPostBack="true" OnItemDataBound="rcbQue5_OnItemDataBound" OnSelectedIndexChanged="rcbQue5_SelectedIndexChanged"></telerik:RadComboBox>
<asp:Label ID="lblQue6Comment" runat="server" Text="" CssClass="que6Comment"></asp:Label>
<asp:HiddenField ID="hdnQue6Comment" runat="server" value="" />
<span id="rcbQue5Err" class="errSpan"></span>

ASPX.CS::
protected void rcbQue5_OnItemDataBound(object sender, RadComboBoxItemEventArgs e)
{
    if (e.Item is RadComboBoxItem)
    {
        string strDefinition = String.Empty;
        .
        .
        .
        ((RadComboBoxItem)e.Item).Attributes.Add("onmouseover", "javascript:return rcbQue5_OnMouseOver(this);");
        ((RadComboBoxItem)e.Item).Attributes.Add("title", strDefinition);
    }
}
0
Hristo Valyavicharski
Telerik team
answered on 18 Mar 2014, 11:25 AM
Hi,

Are these combos inside an Ajax panel? If so try to disable it. Debug the code in the server event of both combos. Are there any server errors?

Regards,
Hristo Valyavicharski
Telerik
 

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

 
Tags
ComboBox
Asked by
kencox
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
VitorBarao
Top achievements
Rank 1
David Samson
Top achievements
Rank 1
Hristo Valyavicharski
Telerik team
Share this question
or