Remember that you have a different syntax for a web control element than you
do for an HTML element. In order to render the HTML "onload='...'" you need
to use Tbx_AssignedTo.Attributes.Add("onload", "..."). The TextBox is an
object that is processed on the server. OnLoad is a method of that object
which invokes some action on the server, and isn't just rendered to the
client as you type it. Your ASPX code is declaratively writing code that the
server generates and compiles - it's a lot more than authoring a DHTML page.
If you don't need the features of a textbox, you can also use <input
type="text" runat="server" ... /> and spare the more verbose syntax needed
to render client side behavior.
--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--
"jib" <ji***@hotmail.com> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
I am trying to set up a OnLoad javascript for a Textbox using the following
script:
<asp:TextBox id="Tbx_AssignedTo" runat="server" Width="184px"
OnLoad="javascript:doTypeSelect(document.activeEle ment.id)">
</asp:TextBox>
However, this gives me a "CS1026: ) expected" error. I haven't got the
foggiest as to what this means. Can anyone shed some light on this?
Thanks!
Jib