8 Answers, 1 is accepted
no function en IE8, But in firefox and chrome its working.
Please see the following help topic how to focus the RadComboBox:
http://www.telerik.com/help/aspnet-ajax/focus-combobox-client-side.html
Greetings,
Helen
the Telerik team
I use the same @Juan,but It 's also work in IE7, Don't work in IE8
Dim ScriptManager1 As New ScriptManager
ScriptManager1.Page = Page
ScriptManager1.SetFocus(cboMaDichVu.ClientID + "_Input")
Notes: I used <telerik:RadAjaxManager ... and set <telerik:AjaxSetting AjaxControlID ="cboMaDichVu">
So what is difference?
Thanks for help!
The code below works at our side in IE8:
//aspx:
<
asp:ScriptManager
ID
=
"ScriptManager1"
runat
=
"server"
>
</
asp:ScriptManager
>
<
telerik:RadComboBox
ID
=
"RadComboBox1"
runat
=
"server"
AllowCustomText
=
"True"
>
<
Items
>
<
telerik:RadComboBoxItem
runat
=
"server"
Text
=
"N"
/>
<
telerik:RadComboBoxItem
runat
=
"server"
Text
=
"S"
/>
<
telerik:RadComboBoxItem
runat
=
"server"
Text
=
"E"
/>
</
Items
>
</
telerik:RadComboBox
>
<
telerik:RadAjaxManager
ID
=
"Manager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"Button1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadComboBox1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
asp:Button
ID
=
"Button1"
runat
=
"server"
onclick
=
"Button1_Click"
Text
=
"Focus ComboBox"
/>
//vb:
Protected
Sub
Button1_Click(sender
As
Object
, e
As
EventArgs)
ScriptManager1.SetFocus(RadComboBox1.ClientID +
"_Input"
)
End
Sub
Does it work at your side?
Greetings,
Helen
the Telerik team
I'm sorry, It does not work.
First, When I add <asp:ScriptManager element in my ascx, It's show messeage :"ScriptManager ... unknow element".
I search around, I down AjaxToolKit.Dll ver 3.5 (I use .NET framework 3.5).Then include I found asp:ToolkitScriptManager
and put below on Page_Load
If(AJAX.IsInstalled()) Then AJAX.RegisterScriptManager() End If
..... on Button_Click
ToolkitScriptManager1.SetFocus(cboMaDichVu.ClientID + "_Input")
But also not work.
I use Donetnuke 5.5 & uncheck partial rendering.
I uncheck Partial Rendering beacause I have used telerik:RadAjaxManager
Thanks for advance.
Could you please send us a sample project which demonstrates the issue to examine it locally?
Regards,
Helen
the Telerik team
When I spend my time for find out solution , I recognize that when event of client javascript excute, then event setfocus of ScriptManager from code behind will be effect.
So that I try with below code, and It's work at both IE7 & IE8.
It's look like a double focus but you can replace the focus event
by
RegisterStartupScript
with another event some kind like show alert messenge, focus other control, then finally ScriptManager1.SetFocus
will be work.Dim
script
As
String
script =
"var comboBox = document.getElementById('"
& cboMaDichVu.ClientID &
"_Input');"
script +=
"comboBox.focus();"
ScriptManager.RegisterStartupScript(Page, Page.
GetType
(),
"script"
, script,
True
)
Dim
ScriptManager1
As
New
ScriptManager
ScriptManager1.Page = Page
ScriptManager1.SetFocus(cboMaDichVu.ClientID +
"_Input"
)