Hi everyone
I have a big problem here, I want to uptade the text of textBox2 as I type in somthing in textBox1.
I tried to set AutoPostBack to true for both of the boxes but it does not work, is there any thing i'm missing, please help me I need this for my project
Loading

motsamai20023 reputationPosted Dec 13, 2005, 11:46 AM EST
SaurabhRank #2,654 · 523 reputationPosted Dec 16, 2005, 12:22 AM EST
set the AutoPostBack event to true, and rite the appropriate TextChanged event.
OnKeyPress event fires only on the client.
This is the code (.aspx and aspx.cs) that solves ure problem :-
<%
@ Page Language="C#" AutoEventWireup="true" CodeFile="Page1.aspx.cs" Inherits="Page1" %>DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml"><
head runat="server"> <title>Untitled Pagetitle> head><
body> <form id="form1" runat="server"> <div> <asp:TextBox ID="TextBox1" runat="server" OnTextChanged="TextBox_TextChanged" AutoPostBack="true">asp:TextBox> div> <div> <asp:TextBox ID="TextBox2" runat="server">asp:TextBox> div> form> body> html>public
partial class Page1 : System.Web.UI.Page{
protected void Page_Load(object sender, EventArgs e){
}
protected void TextBox_TextChanged(object sender, EventArgs e){
if (TextBox1.Text.Trim() != string.Empty){
TextBox2.Text = TextBox1.Text.Trim();
}
}
}
Rendy Wendi14 reputationPosted Dec 17, 2005, 2:00 PM EST