troubleshooting Question

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

Avatar of Eric3141
Eric3141Flag for Afghanistan asked on
.NET ProgrammingC#ASP.NET
1 Comment1 Solution1910 ViewsLast Modified:
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 );

...

}
ASKER CERTIFIED SOLUTION
Eric3141

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros