N
Neil Stevens
Hi,
Merry Christmas to you all.
I have a problem with server controls, i am writing a C# ASP.NET web project
and i am creating custom server controls for some of the more common
element. One example is a NavigationMenu control or a Login control.
The problem is that when the page renders, say, the Login control, the ID of
the username field is changed from
id="username"
to
id="Login_ctl0__username"
or somthing like that...lol
Now, i have a generic javascript function
document.getElementById(username.ID).focus();
which sets focus to the specified control id and while the control is
rendered this javascript is added to the page using
Page.RenderStartupScript("focusScript", script).
This causes a javascript error because username.ID="username" when the page
is being rendered but by the time the script executes the username controls
id has changed to Login_ctl0__username.
Is there a way that i can prevent this from happening or a way that i can
get the correct id at the time my control is rendered.
Sorry about the length of this post, and hope someone can help.
Merry Christmas
Neil
Merry Christmas to you all.
I have a problem with server controls, i am writing a C# ASP.NET web project
and i am creating custom server controls for some of the more common
element. One example is a NavigationMenu control or a Login control.
The problem is that when the page renders, say, the Login control, the ID of
the username field is changed from
id="username"
to
id="Login_ctl0__username"
or somthing like that...lol
Now, i have a generic javascript function
document.getElementById(username.ID).focus();
which sets focus to the specified control id and while the control is
rendered this javascript is added to the page using
Page.RenderStartupScript("focusScript", script).
This causes a javascript error because username.ID="username" when the page
is being rendered but by the time the script executes the username controls
id has changed to Login_ctl0__username.
Is there a way that i can prevent this from happening or a way that i can
get the correct id at the time my control is rendered.
Sorry about the length of this post, and hope someone can help.
Merry Christmas
Neil