Avatar of Eric3141
Eric3141Flag 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
Eric3141
ASKER CERTIFIED SOLUTION
Avatar of Eric3141
Eric3141
Flag of Afghanistan image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
.NET Programming
.NET Programming

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.

137K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo