ASP.NET GridView order of operation

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Mar 2007
Posts: 2
Reputation: Dr Dave is an unknown quantity at this point 
Solved Threads: 0
Dr Dave Dr Dave is offline Offline
Newbie Poster

ASP.NET GridView order of operation

 
0
  #1
Mar 19th, 2007
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
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 2
Reputation: Dr Dave is an unknown quantity at this point 
Solved Threads: 0
Dr Dave Dr Dave is offline Offline
Newbie Poster

Re: ASP.NET GridView order of operation

 
0
  #2
Mar 21st, 2007
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 7130 | Replies: 1
Thread Tools Search this Thread



Tag cloud for C#
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC