Solved

Update Other Text on Textbox TextChanged Event

Posted on 2010-09-21
4
886 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

708 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

14 Experts available now in Live!

Get 1:1 Help Now