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
Rendy WendiPosted Dec 17, 2005, 7:00 PM
SaurabhPosted Dec 16, 2005, 5:22 AM
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();
}
}
}
motsamai2002Posted Dec 13, 2005, 4:46 PM