472,993 Members | 2,234 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,993 software developers and data experts.

Postback data problem

2
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
Apr 10 '08 #1
0 1649

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Igor Belagorudsky | last post by:
Hi, i am trying to analyze data submitted in a form but the problem is that when i try to create the controls in code (which is what i want to do), it throws an obect not found exception on...
10
by: Krista Lemieux | last post by:
I'm new to ASP.NET and I'm not use to the way things are handled with this technology. I've been told that when I have a control, I should only bind the data to it once, and not on each post back...
2
by: RAJ | last post by:
In our multi-tier application, we have several ASP.NET user controls which will update the same data source provided by middle tier logic. In this particular scenario we have one user control...
6
by: | last post by:
Hi all, I have a bunch of dropdownlists that are populated in client-side javascript. When i do a postback I get the following error:- Invalid postback or callback argument. Event...
1
by: Timbo | last post by:
Hi all, This is my first message here so i'll try and include all the information that will help you help me out, if possible. Basically I am using C# in ASP.NET 2.0 and have a Repeater...
1
by: Jason | last post by:
I have a webpage that I've wrapped in an Atlas UpdatePanel. This page contains four textboxes, each with AutoPostBack set to true. The problem comes when someone edits the first box and tabs to...
15
by: mc | last post by:
I'm writing an app for managing Task Lists, I'm trying to add some controls to a form that I can use to link tasks, my original intention was to: - Add two list boxes, one listing "all Tasks"...
2
by: Nathan Sokalski | last post by:
I have a DataList in which the ItemTemplate contains two Button controls that use EventBubbling. When I click either of them I receive the following error: Server Error in '/' Application....
2
by: John Kotuby | last post by:
Hi guys, I am converting a rather complicated database driven Web application from classic ASP to ASP.NET 2.0 using VB 2005 as the programming language. The original ASP application works quite...
4
by: Harry | last post by:
Hi, This aspx page (let's call it thispage.aspx) fetches data from a sqldatasource, then performs several things (in code-behind) and, to simplify, passes data from code-behind via a hiddenfield...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.