Solved

Modal Popup selecting setting drop list on parent form

Posted on 2014-11-03
7
192 Views
Last Modified: 2014-11-28
I have an asp.net form with a selection list on it that contains many items.  I want a modal popup to provide search criteria to narrow the selection, and once the selection is made, to set the ddlb on the parent form (and close the modal popup).  I am having trouble getting this to work.  When I choose the item in my modal popup, I call a method on the parent form to select the ddlb.  It doesn't work (the selection is made, but it doesn't persist).  I think I need to post back the form.  When I try and use the timer to generate a postback, the timer fires continuously, even after I disable it.

What would the proper way to code this be?
0
Comment
Question by:No1Coder
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
7 Comments
 
LVL 20

Expert Comment

by:Daniel Van Der Werken
ID: 40423730
You can't really have a child call a parent in ASP .NET. It works the other way around just fine. You need to persist value you're selected. Probably your best bet is to use a session variable. Do something like this:

Session["MyVariableName"] = value_selected_by_user_in_modal_box;

Then, when the modal dialog is closed, get the value such like:

string mySelectedValue = Session["MyVariableName"].ToString();

or

int mySelectedInt = int.MinValue;
int.TryParse(Session["MyVariableName"].ToString(), out mySelectedInt); // gets the integer value.
0
 

Author Comment

by:No1Coder
ID: 40423783
Okay, but what event triggers the selection being set from the session variable?

Currently, when he hits OK on the popup, I locate the parent using something like:

parent = (ucParent)this.Parent.Parent.Parent;  

Then I call a method on parent to do some work:

parent.RefreshDropDown(valueselected)

The method gets called, and the DDLB value is selected, but it doesn't persist.  This technique I guess is not valid, but not sure why.  I have tried firing a timer event in the parent method, and setting the ddlb value on the timer event, but this has different issues.  The timer continuously fires, even after being disabled.

So, if instead I set a session variable when he hits OK, how do I trigger an event on the parent to refresh the DDLB?

Thanks for assisting.
0
 

Author Comment

by:No1Coder
ID: 40449565
Additional Information

On my modal popup, the user clicks a selection link.  This causes the selection to be made, and the modal popup to close (manually, using Hide).  When debugging (with breakpoints set), this causes a postback on parent form.  When running without breakpoints, no parent postback occurs.  Somehow, I need to reliably notify the parent form that the modal popup has closed.  Is there a recommended way to do this?
0
 

Accepted Solution

by:
No1Coder earned 0 total points
ID: 40460516
I resolved the issue.  In the popup window, i used jquery code to generate acpostback on parrent form by clicking a hidden button.
0
 

Author Closing Comment

by:No1Coder
ID: 40470196
Solution found
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Filtering a datagrid view 8 34
Record locking on classic ASP 3 37
Exchange OWA website Redirection 7 41
Secure log in 'box' 4 10
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

761 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question