Solved

Modal Popup selecting setting drop list on parent form

Posted on 2014-11-03
7
193 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

Technology Partners: 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
TCP Chat/GPS application security thru firewall 4 51
Good forum hosting with good privacy policy 3 29
ReadyAPI 1.9.0 2 38
How does this modal gets closed? 6 38
When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

738 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