Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 680323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:21:35+00:00 2026-05-14T01:21:35+00:00

I have an asp:FormView control bound to a datasource. Everything is working fine. If

  • 0

I have an asp:FormView control bound to a datasource. Everything is working fine.

If I put the following code in the Init event:

Private Sub frmEdit_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles frmEdit.Init
   Debug.WriteLine(frmEdit.Controls.Count)
End Sub

…..the update no longer works (no exceptions, it just reloads itself with the old data.)

However, if I change it to this:

Private Sub frmEdit_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles frmEdit.Init
   Debug.WriteLine("hello world")
End Sub

….it works again. So, the difference is that I am accessing the frmEdit.Controls in the first example. My question is, why does this break it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T01:21:35+00:00Added an answer on May 14, 2026 at 1:21 am

    When you access a Control collection, you are triggering code ensuring that the child controls are initialized as well. For a FormView, Init is far too early in the lifecycle for this. You’re initializing controls before the ViewState is ready, so the controls aren’t going to be re-populated correctly.

    You can access the controls later in the lifecycle and I think frmEdit.Row.Controls is what you’re after.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: <asp:FormView ID=PhotoFormView runat=server DataKeyNames=PhotoID DataSourceID=PhotoDataSource> <EmptyDataTemplate> No photo here.
I have a ASP.NET page with a FormView control. When the FormView is bound
I have an asp:FormView on a control (in an ascx file) which is loaded
I have a FormView control in an ASP.NET 2.0 app. I've got the database
Greetings! I have a Repeater control that's using an XmlDataSource control. <asp:FormView id=myFormView runat=server
Greetings! I have a DropDownList within a FormView which are bound to XmlDataSources: <asp:FormView
I have am using an asp:FormView control with elements such as: <asp:TextBox id=FirstName runat=server
I have a FormView control in an ASP.NET page. I use the InsertItemTemplate and
I have an asp.net Formview connected to an SQL datasource. When I create/edit/delete a
I have an asp:FormView with an ItemTemplate. I'd like to design the content within

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.