Solved

Update Other Text on Textbox TextChanged Event

Posted on 2010-09-21
4
920 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

737 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