I have a problem at the moment with a web project.

I have two Panels within an UpdatePanel on an aspx page (using Masterpages). I'm using ASP.Net 2.0 with an AJAX enabled website.

The two Panels represent a Master-Detail type relationship. I want a user to click a LinkButton in the first Panel and then for the 2nd Panel to be displayed with the detail.

However, I need to set some text properties of textboxes programmatically when the LinkButton is clicked.

The problem, though, is that the UpdatePanel's Load event fires BEFORE the LinkButton's click event. The data needs to be in the textboxes before the UpdatePanel's Load event fires, as it renders items depending upon this data.

I was wondering if a client-side solution might work?

Is there a way I could wire the "OnClientClick" of the LinkButton to a client-side JavaScript function that would write the appropriate text to a hidden field or other control or variable that could be then read in the code behind when the UpdatePanel's Load event fires?

Or, is there an easier or better way of doing this? Am I missing something on the event sequence for the UpdatePanel??

The linkbutton is in the ItemTemplate of the gridview on each row.

The gridview is in a Panel which is in an UpdatePanel. This is the "master" view, containing a list of data items. The UpdatePanel also contains another Panel. This second panel is the details view, which should display the details of a selected item the user picks from the first panel.

But, both the panels in the UpdatePanel reside in the same space. So, when the user selects an item, the master panel becomes invisible and the details panel is in view.

I want to click on the link button and then view the details in another panel, with the master panel becoming invisible.

The project I am working on is a little different in that an XML datasource is being used via a bespoke provider, so I can't quite link things up the way described above. However, I have tried this with the appropriate adjustment, using the HyperLinkField.

It has been suggested to me to use a HyperLinkField that maps a value to a QueryString parameter. This would certainly work. However, it does not look like it's a suitable solution as there is a more general issue in that this is an AJAX enabled website.

The idea of the UpdatePanel, and the two normal Panels within, is that the transition should be visibly seamless between viewing a list of data items in the master view (in the 1st panel) and the details of a particular selected item in the details view (the 2nd panel).

In other words, it relies upon a partial page postback on the UpdatePanel.

However, when the link for a hyperlink control or hyperlinkfield is clicked, the page is requested as a completely new request and therefore does not cause a postback to occur. This results in the whole page loading again, which is not what is desired here.

The project also uses a masterpage.

The UploadPanel has both Load() and PreRender() events. Within these events is the code that determines which panel is displayed upon a partial page postback. So, prior to the content of these event handlers executing, I need to determine which item was selected from the GridView (each item in the Grid is identified by a unique string ID).

I am now struggling a little with this one. I've been through a few books and am still not getting anywhere. Frustrating.

Any help much appreciated on this.

Thanks - Darren