Avatar of Eric3141
Flag for Afghanistan asked on

ItemUpdating event -- FindControl returns old value of textbox on formview & not new updated value

Note: Answers in C# please - thx!

I have FormView1 with txtbxEditTemplatePopCount TextBox on it.  txtbxEditTemplatePopCount is the name of the textbox on the Edit template -- the same corresponding textbox on the Item & Insert templates has another name.  When the form comes up in Edit mode the current value is in the textbox.  I change the value and click the Update button -- as soon as I do that then on-screen the value in the textbox goes back to what it was originally and the original value is sent as parameter to the method call.  Code is below.  The code is finding the control on the formview but won't take the new value and keeps using the old one.  Very confused!  Help!

    protected void FormView1_ItemUpdating(object sender, FormViewUpdateEventArgs e)
         TextBox txtbxCensusPopCount  = (TextBox)FormView1.FindControl("txtbxEditTemplatePopCount");

intCensusPopCount = Convert.ToInt32(txtbxCensusPopCount.Text);

strError = BLL_Census(intCensusPopCount );



Open in new window

ASP.NETC#.NET Programming

Avatar of undefined
Last Comment

8/22/2022 - Mon

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Your help has saved me hundreds of hours of internet surfing.