JavaScript events

J

Javier Ros

hi guys,

I want to write events in JavaScript for my asp controls (TextBox for
example).

This is the HTML code of my WebForm, it have only a TextBox:

<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false"
Inherits="WebApplication1.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="...">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:TextBox id="TextBox1" style="Z-INDEX: 101; LEFT: 164px; POSITION:
absolute; TOP: 80px" runat="server"></asp:TextBox>
</form>
</body>
</HTML>

And this is the HTML code generate by the server:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="...">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form name="Form1" method="post" action="WebForm1.aspx" id="Form1">
<input type="hidden" name="__VIEWSTATE"
value="dDwyMTA1NTI4MTE3Ozs+u44Ib3Yg/KNtF+PuxRv2LA/u8HE=" />

<input name="TextBox1" type="text" id="TextBox1" style="Z-INDEX: 101;
LEFT: 164px; POSITION: absolute; TOP: 80px" />
</form>
</body>
</HTML>

Well, how to add 'OnExit = "callMyJavaScriptFunction();"' to "input" tag in
the generate Code by the server from C# codebehind?
I have thought in "PreRender" Event of TextBox Control but ... I don´t know
how to.

thanks in advance.

..Javier Ros Moreno.

P.D.: Sorry, my Inglish is poor, I want generate this:
I want this: <input name="TextBox1" type="text" id="TextBox1"
style="Z-INDEX: 101; LEFT: 164px; POSITION: absolute; TOP: 80px" OnExit =
"callMyJavaScriptFunction();" />
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,158
Latest member
Vinay_Kumar Nevatia
Top