Textbox's TextChanged event doesn't work in FormView Insertmode

Last post 10-07-2008 2:14 AM by Hua-Jun Li - MSFT. 2 replies.

Sort Posts:

  • Textbox's TextChanged event doesn't work in FormView Insertmode

    10-02-2008, 1:51 PM
    • Member
      82 point Member
    • asdpai
    • Member since 10-23-2003, 9:40 AM
    • Posts 47

    TextChanged not firing:


        protected void TextBoxA_TextChanged(object sender, EventArgs e)
        {
            TextBox textboxA = (TextBox)FormView1.FindControl("TextBoxA");       
            TextBox textboxB = (TextBox)FormView1.FindControl("TextBoxB");
            textboxB.Text=textboxA.Text;
            
        }

  • Re: Textbox's TextChanged event doesn't work in FormView Insertmode

    10-02-2008, 2:47 PM
    Answer
    • All-Star
      91,031 point All-Star
    • vinz
    • Member since 10-05-2007, 11:47 AM
    • Cebu, Philippines
    • Posts 13,699
    • TrustedFriends-MVPs

    Be sure that you have set AutoPostBack to TRUE in your TextBox to fire up the event

    Best Regards,
    Vincent Maverick Durano
    SDE|Microsoft MVP - ASP/ASP.NET

    "Code,Beer and Music ~ my way of being a programmer"

  • Re: Textbox's TextChanged event doesn't work in FormView Insertmode

    10-07-2008, 2:14 AM
    Answer

    Hi asdpai,

    We should set Textbox autopostback property to true and offer a textchanged event handler in codefile.

    And we should find textbox at the following method.

        protected void TextBoxA_TextChanged(object sender, EventArgs e)
        {
            TextBox textboxA = (TextBox)FormView1.Row.FindControl("TextBoxA");       
            TextBox textboxB = (TextBox)FormView1.Row.FindControl("TextBoxB");
            textboxB.Text=textboxA.Text;
            
        }

    Sincerely,
    Hua Jun Li
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Page 1 of 1 (3 items)