I have a formview bound to a LinqDataSource. The FormView is in InsertMode. I am trying to change a control in the FormView in my Page_Load like so:
(FormView1.FindControl("tb
VendorNumb
er") as TextBox).Text = "CHANGED";
This does NOT throw an exception. It runs like everything is fine, but it does not change the textbox in question. When I bind to an objectDataSource however, it works just fine.
This ONLY happens when I'm in Insert mode. When I change my InsertTemplate to EditItemTemplate, my controls change as they should. Also, when I bind to an ObjectDataSource, the InsertTemplate responds like it should.
Can anyone tell me why being bound to a LinqDataSource is screwing up my ability to call myFormView.FindControl("")
and modify the returned control.
Thanks!
Start Free Trial