從下拉列表中選擇一個項目後,我需要關注文本框。control.focus()selectedIndexChanged後
我試過control.focus()和setfocus()。
我試過的最後一件事是Set_Focus(dtbEffectiveDate.ClientID)與SelectedIndexChanged方法內的方法。
Protected Sub Set_Focus(ByVal ControlName As String)
Dim strScript As String
strScript = "<script language=javascript> window.setTimeout(""" + ControlName + ".focus();"",0); </script>"
RegisterStartupScript("focus", strScript)
End Sub
我沒有答案,所以任何幫助都會很棒。
此外,你會想要做的'window.onload'確保對焦之前的控制也存在。 – mellamokb 2011-03-07 16:14:03
「無法將焦點移到控件上,因爲它是不可見的,未啓用或不接受焦點的類型。」 – kyle 2011-03-07 16:31:45
@kyle:你可以發佈一些代碼示例嗎?我們都提出的代碼應該可以工作,並且我們需要更多的細節來給出更好的答案。 – mellamokb 2011-03-07 16:47:29