| | |
ASP.NET GridView order of operation
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Mar 2007
Posts: 2
Reputation:
Solved Threads: 0
Greetings,
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.
--
Dr. Dave
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.
--
Dr. Dave
•
•
Join Date: Mar 2007
Posts: 2
Reputation:
Solved Threads: 0
I solved the issue. Because I am using an AJAX extender (specifically, the accordian extender) on the first time the page loads any ASP.NET Control inside the extender is not visable to the page until the page fully executes its life cycle.
I put a single FindControl at the point in my code behind before I attempted to populate my TextBox controls inside the extender, and it all worked.
Moral to the story, objects must be visible before you use them.
Regards
--
Dr. Dave
I put a single FindControl at the point in my code behind before I attempted to populate my TextBox controls inside the extender, and it all worked.
Moral to the story, objects must be visible before you use them.
Regards
--
Dr. Dave
![]() |
Similar Threads
- Simple ASP.Net Login Page using C# (C#)
- Problem with Crystal Report in ASP.NET (ASP.NET)
- are C#, VB.NET, ASP.NET part of new VS.NET? (ASP.NET)
- ASP.Net Security 101 Part 1 (ASP.NET)
- Error creating new ASP.Net project (ASP.NET)
- IIS and ASP.Net (ASP.NET)
- Populating & Retrieving Data in a listbox : ASP.NET (w/ VB.NET) (ASP.NET)
Other Threads in the C# Forum
- Previous Thread: ComboBox woes
- Next Thread: calculations in formview with C#
Views: 7130 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for C#
.net access ado.net algorithm array barchart bitmap box broadcast button c# chat check checkbox class client color combobox control conversion csharp custom database datagrid datagridview dataset datetime degrees development draganddrop drawing encryption enum event excel file files form format forms ftp function gdi+ httpwebrequest image index input install java label list listbox listener login math mouseclick mysql networking object operator path photoshop picturebox pixelinversion post prime programming radians regex remote remoting resource save saving serialization server sleep socket sql statistics stream string table tcp text textbox thread time timer treeview update usercontrol validation view visualstudio webbrowser windows winforms wpf xml





