• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 991
  • Last Modified:

Update Other Text on Textbox TextChanged Event

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
Sheritlw
Asked:
Sheritlw
  • 2
3 Solutions
 
rockiroadsCommented:
did u try placing a breakpoint and run it thru debugger?

0
 
rockiroadsCommented:
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
 
MikeMCSDCommented:
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
 
SheritlwAuthor Commented:
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now