I am working with ASP.NET 2.0 GridView. I have a GridView nested in a View control. When I select a record from the GridView I want to populate the records values by Key into a collection of TextBoxes in a second View control within my MultiView. From a scope point of view, this (in theory) should work.
Simple... or so I thought.
Let me set this up a bit more.
I have two View controls, vDisplay and vBuild. Each of these View controls are nested in a MultiView mvProducts.
When I enter vDisplay I have a GridView that displays selected data pulled from SQL Server. When I select a record from the GridView I want to load the key values into a collection of TextBox controls in vBuild View control. On the first time through my vBuild does not display the data, and I get an "Object reference not set to an instance of an object."
Now I know that means I have not instantiated or initialized a control. However, all the controls are present on the Web page.
Now here's the twist. If I navigate to my vBuild View control, then navigate back to my vDisplay View control and select a record I am successfully able to navigate to my vBuild View control with populated data.
My question, has anyone experienced this type of issue before, can anyone explain to me the order of operation for the GridView, what the page life cycle should look like, or if you have a solution.... Please share.
I thank you in advance for your thoughtful and insightful assistance.