Hi friends.........
Am using a one Textarea and Text box and a Button in my application.. whenever i write a text in textbox and click on the button . textbox value is copied to Textarea... This logic i have written in Button_Click event. Now in an situation i dont want to use a button to copy textbox value to Textarea.. i want to copy the textbox value to textarea, whenever i click on the Enter Button in Keyboard. This is like GoogleChat... after writing the text in textbox , i want to Press Enter Key.. not a Button.. How to implement this..

hey you can use the following code.. it may help u out...

<%@ 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>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.