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

[Solved] Multiple User Controls Containing Combobox

1 Answer 85 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Greg
Top achievements
Rank 1
Greg asked on 09 Jul 2009, 05:40 PM
I created a custom web user control simply with a drop down box and an image.
I have a javascript on the user control to capture the click on the image and automatically fire off the drop down box (similar to your TimePicker)
Very simple.....

<

 

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

 

 

 

function SetFocus() {

 

 

var comboBox = $find("<%=cboTime.ClientID %>");

 

 

var input = comboBox.get_inputDomElement();

 

 

input.focus();

}

 

 

</

 

script>

 

 

 

<

 

telerik:RadComboBox ID="cboTime" Runat="server" Width="100px" AllowCustomText="true">

 

 

 

</

 

telerik:RadComboBox>&nbsp;&nbsp;<a href="JavaScript:SetFocus()"><asp:Image id = "imgClock" alt="Time" style="height:15; width:15;" runat="server" /></a>

 

 

 

 

 


I have placed 2 of the user controls on my page.

My problem is when I click on either of the images, the focus goes to the last instance of the drop down box.
I looked at the generated code and it appears that the script is in there both times and since the script is named the same, the last definition overwrites any earlier versions.

How do I uniquely define the script so that the click knows which drop down to get focus?
Also I'd like to fire the drop down instead of just focus...which event do I use?

Thanks
Greg

1 Answer, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 10 Jul 2009, 11:17 AM
Hello Greg Vestal,

Please check this KB article:
Using dynamic/unique names for JavaScript functions

All the best,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
ComboBox
Asked by
Greg
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Share this question
or