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

Problem setting focus on page load

2 Answers 86 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Ricky
Top achievements
Rank 2
Ricky asked on 04 Jul 2008, 01:46 AM
Hi

I have page which opens a PDF file as well have few text boxes and drop down combos for data Entry. PDF file is opening in a Frame.

Now on the page load i need to set the focus on first Combo box and which works fine if the frame does not have any PDF file to open.

So when there is a PDf file and it opens it then it lose Focus. I reckon because the PDF file takes time to load. Still the cursor goes to the combo box but then disappear.


Can any one please help me regarding this.

Thanks in Advance
Ricky

2 Answers, 1 is accepted

Sort by
0
Accepted
Veselin Vasilev
Telerik team
answered on 07 Jul 2008, 11:28 AM
Hi Ricky,

Is it possible that the pdf viewer steals the focus from the combobox?

Also, you can try setting the focus on the combobox using the setTimeout method:

<script type="text/javascript"
  function pageLoad() 
  { 
    var comboBox = $find("<%=RadComboBox1.ClientID %>"); 
    var input = comboBox.get_inputDomElement(); 
    var timeoutMilliseconds = 100; 
    setTimeout(function () {input.focus();}, timeoutMilliseconds); 
  } 
</script>     


You can play with the timeoutMilliseconds variable.

I hope this helps.

Regards,
Veskoni
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Ricky
Top achievements
Rank 2
answered on 07 Jul 2008, 10:56 PM
Hi Veskoni

Thank you so much. The code works perfectly.

thanks once again

Ricky
Tags
ComboBox
Asked by
Ricky
Top achievements
Rank 2
Answers by
Veselin Vasilev
Telerik team
Ricky
Top achievements
Rank 2
Share this question
or