Solved

Update Other Text on Textbox TextChanged Event

Posted on 2010-09-21
4
895 Views
Last Modified: 2012-05-10
Hi,
I have been trying to get the TextChanged Event to fire in the code behind, after someone has edited a textbox.
I have autopostback = true, and have tried creating another event and then assign it to the textbox control.
I can't get any event to fire.
I am using the wizard control and the code behind recognizes the textboxes.
What am I doing wrong????
Protected Sub txtFirstName_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtFirstName.TextChanged

          SetFullName()

     End Sub



     Public Sub SetFullName()

          Me.txtFullName.Text = Me.txtFirstName.Text & " " & Me.txtLastName.Text

          Me.txtDomain.Text = Me.txtFirstName.Text & Me.txtLastName.Text

          Me.lblDomain.Text = "www.sms.com/" & Me.txtDomain.Text

     End Sub



     Protected Sub txtLastName_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtLastName.TextChanged

          SetFullName()

     End Sub





<tr>

                              <td>

                                   First Name:</td>

                              <td>

                                

                                   <asp:TextBox ID="txtFirstName" runat="server" CssClass="wizardboxes"

                                        MaxLength="50" Width="70%" AutoPostBack="true" ></asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 

                                        ControlToValidate="txtFirstName" Display="Dynamic" 

                                        ErrorMessage="First name is required."></asp:RequiredFieldValidator></td>

                          </tr>

                          <tr>

                              <td>

                                   Last Name:</td><td>

                                   <asp:TextBox ID="txtLastName" runat="server" CssClass="wizardboxes" 

                                        MaxLength="50" Width="70%" AutoPostBack="true"  ></asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 

                                        ControlToValidate="txtLastName" Display="Dynamic" 

                                        ErrorMessage="Last name is required."></asp:RequiredFieldValidator></td>

                          </tr>

Open in new window

0
Comment
Question by:Sheritlw
  • 2
4 Comments
 
LVL 65

Expert Comment

by:rockiroads
ID: 33731923
did u try placing a breakpoint and run it thru debugger?

0
 
LVL 65

Assisted Solution

by:rockiroads
rockiroads earned 250 total points
ID: 33731929
I prefer my code to be behind the module.

how did u generate this code? did u go into design view then double click on the control? or something along those lines?

gotta go, be back in the a.m.
0
 
LVL 16

Assisted Solution

by:MikeMCSD
MikeMCSD earned 250 total points
ID: 33731937
See if this works:

<asp:TextBox ID="Address1" runat ="server"></asp:TextBox>
<br />
<asp:TextBox ID="Address2" runat ="server"></asp:TextBox>


 protected void Page_Load(object sender, EventArgs e)
  {
    Address1.Attributes.Add("onkeyup", "document.getElementById('Address2').value= document.getElementById(this.id).value;");
.......
0
 

Accepted Solution

by:
Sheritlw earned 0 total points
ID: 33731992
Hi, everyone

I appreciate all your answers and will split the points between you, but I found out what I didn't do.
Something simple
EnableViewState="true"

Thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now