I am trying to set the focus on an object using the following: However, I
am getting the following error:
The name Clientscript does not exist in the current context.
protected void SetFocusControl(Control FocusControl)
{
StringBuilder script = new StringBuilder();
string ClientID = FocusControl.ClientID;
script.Append("<script language='javascript'>");
script.Append("document.getElementById('");
script.Append(ClientID);
script.Append("').focus();");
script.Append("</script>");
Clientscript.RegisterStartupscript("SetFocusControl", script);
}try it with the correct case
ClientScript.RegisterStartupscript("SetFocusControl", script);
--
Regards
John Timney (MVP)
"sck10" <sck10@.online.nospamwrote in message
news:O23DxRPsGHA.4380@.TK2MSFTNGP05.phx.gbl...
Quote:
Originally Posted by
Hello,
>
I am trying to set the focus on an object using the following: However, I
am getting the following error:
>
The name Clientscript does not exist in the current context.
>
protected void SetFocusControl(Control FocusControl)
{
StringBuilder script = new StringBuilder();
string ClientID = FocusControl.ClientID;
script.Append("<script language='javascript'>");
script.Append("document.getElementById('");
script.Append(ClientID);
script.Append("').focus();");
script.Append("</script>");
Clientscript.RegisterStartupscript("SetFocusControl", script);
}
>
Thanks John...
"John Timney (MVP)" <x_john@.timney.eclipse.co.ukwrote in message
news:5KednZH2LoThRFrZRVnyiA@.eclipse.net.uk...
Quote:
Originally Posted by
try it with the correct case
>
ClientScript.RegisterStartupscript("SetFocusControl", script);
>
--
Regards
>
John Timney (MVP)
>
>
"sck10" <sck10@.online.nospamwrote in message
news:O23DxRPsGHA.4380@.TK2MSFTNGP05.phx.gbl...
Quote:
Originally Posted by
>Hello,
>>
>I am trying to set the focus on an object using the following: However,
>I am getting the following error:
>>
>The name Clientscript does not exist in the current context.
>>
>protected void SetFocusControl(Control FocusControl)
>{
> StringBuilder script = new StringBuilder();
> string ClientID = FocusControl.ClientID;
> script.Append("<script language='javascript'>");
> script.Append("document.getElementById('");
> script.Append(ClientID);
> script.Append("').focus();");
> script.Append("</script>");
> Clientscript.RegisterStartupscript("SetFocusControl", script);
>}
>>
>
>
On Wed, 26 Jul 2006 16:39:00 -0500, "sck10" <sck10@.online.nospam>
wrote:
Quote:
Originally Posted by
>Thanks John...
>
>
With 2.0, controls have a Focus method that seems to do the same
thing. Actually a bit better because it takes care of ClientId if
using a master page.
0 comments:
Post a Comment