473,289 Members | 2,108 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,289 software developers and data experts.

key press event on a ASP.net text box

I got a ASP.net text box called textbox1 and a label called label1.

When a key is press in a text box i want it to up date the label with
what is in the textbox.

Label1.Text = TextBox1.Text;

But on a ASP.net text box there is no on key press event like this is
on a normal html text box but if i do the event in the normal html text
box i can't use the code in the .aspx.cs file.

How can i get round this?

Thanks

Donald

May 16 '06 #1
1 5437
i work out i need to do this client side so i got the below how can i
get the javascript to use the textbox and label in my asp part?

i have the below code that i started with

<%@ Page Language="C#" %>
<script runat="server">

protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
Label1.Text = "Start";
}
TextBox1.Attributes.Add("onkeyup", "rewriteLabel()");
}
</script>

<script type="text/javascript">

function rewriteLabel(){
TextBox1.Text = Label1.text;
}

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head >
<title >test</title>
</head>
<body>
<form id="form1" runat="server">
<br />
<asp:TextBox ID="TextBox1" runat="server" /><br />
<asp:Label ID="Label1" Runat="server" BorderWidth="1px" />
</form>
</body>
</html>

May 16 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: dixie | last post by:
I want to run an event when I press the Ctl key simultaneously with the K key. How do I achieve this in VBA? dixie
2
by: csgraham74 | last post by:
Hello, I wonder if someone could help me. I have an asp.net form which collects data from a piece of XML and displays it on screen. If a piece of data is incorrect i will select the textbox...
3
by: jimmy | last post by:
Hi all I am making a program whereby when the insert key is pressed in a text box it opens up another form with the search parameters they entered in the text box and automatically searches for...
2
by: Greoasy | last post by:
I have a registration page with no of text boxes and 3 buttons for insert update and delete. and a logout button on the top of the page. If i place my control in an of the text box and press enter...
1
by: Sendil kumar | last post by:
When I do a Ctrl-C(copy) on a text, the text was not copied. By narrowing down the problem I found that VC++ message map is not capturing the Ctrl-C key press event(Only captures the first key press,...
7
by: thomask | last post by:
Hello my friends , How to implement key press event for checking whether the value entered in the text box is integer.(ie if we press any alphabetic letter in the text box, at the key press it...
5
by: hmkaddoura | last post by:
Hi All, in my form I have two textboxes (T1,T2) and two buttons (B1,B2) how can i insert text in T1 and press enter to execute B1 event, and insert text in T2 and press enter to execute B2...
9
by: sunita jadhav | last post by:
my question is if i type in html textbox on key press event suppose i type 12345 values in textbox then i delete or edit any value of text box suppose i edit 3 and i insert the value 6 at 3 but i...
1
by: daonho | last post by:
I tried to use javascript to trigger up the button click function when user press enter key from the textbox. This function work fine with a single button click such has login page. However, if the...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.