tags:

views:

187

answers:

1

Imagine an ASP.NET data input form with a "client" entry field. The dataset of possible clients numbers in the millions. What I would like to do is put an asp:LinkButton control labeled "Look-up Client" on the form which would launch a modal AJAX form allowing the user to search by fields such as last/first name, address, phone, etc, and display a grid of clients matching the search parameters, from which the user would select a client and the modal form goes away and the LinkButton then reads something like "John Smith (click for more info)" and the clientID is stored to a non-visible form field.

My plan was to use an ASP:UpdatePanel linked to a ModalPopupExtender control but the problem I'm running into is that anytime an ASP:Button control is clicked on the ModalPopupExtender form (1) it doesn't seem to actually run the code-behind code (breakpoints aren't being hit), and (2) the modal window goes away even though the button clicked isn't the OkControlID or CancelControlID.

With all of that as background, my question is this: How do I achieve what I've described here? Am I even on the right track, or am I trying to do something that is beyond the scope of the ModalPopupExtender control? (And if the latter is the case, what is the right way to do it?)

A: 

Put a Panel with an UpdatePanel inside it. Inside the updatePanel you'll have your grid/search textbox/search button etc for the search. Now outside of the panel, put the "lookup client" link and the ModalPopupExtender (linking ot the first Panel, not the update panel).

Lastly, you'll need to pass that information back to your main form. Either javascript, full postbacks on the entire page or another updatepanel around the control that you're adding the client to would work, it depends on what you have.

Personally,though, I would rather implement the search/table in javascript and just have a simple webservice that looks up the users and returns JSON. From my experience, UpdatePanels are extremely heavy and end up causing a lot more trouble than you can imagine..

Eduardo Scoz
Okay -- that partially worked, but it seems I can only make *ONE* postback. For example, if I search for LastName='Smith' AND FirstName='John' I get data back. But if I want to refine the search to something like FirstName='Johnathan' nothing happens when I re-click the ASP:Button control that worked the previous time. Any ideas?
Parvenu74
Are you getting any errors (javascript or code behind)? I can't imagine why posting back twice wouldn't work. Is the search button inside or outside the updatepanel?
Eduardo Scoz
I get a javascript error on initial page load in development: something about a value 'e' being undefined, but I didn't set anything yet. Could there possibly be an error in the platform itself?
Parvenu74

related questions