situation with need to update dropdown on another page

G

Guest

I pop up a Modal form on a web page that allows the user to update the
selections of a dropdownlist via adding a new item to the db (Sql Server).The
only thing is this list is on the page beneath it. So when the user updates
the db with a new selection, and then closes the form, the page below must be
refreshed to see the new option.

Any ideas on adding the new option to the control below the modal form?

thanx.
 
S

Steve C. Orr [MVP, MCSD]

This client side javascript should do the trick:

window.opener.location.reload(true);
 
G

Guest

I assume this is for the form that opened the showmodel pop-up?
If so, will this affect any of the fields/values on that form. I'm not
performing a post back so I do not want to reset the fields.
If on the parent page, where should I launch this?

would you know of a code behind method on the form that was popped up? I
know framewrok 2.0 has an option to access prevoius pages controls, but I'm
using 1.1.

thanx.
 
S

Steve C. Orr [MVP, MCSD]

The two pages do not exist on the server at the same point in time,
therefore you must use client side code for this situation.
The code snippet I gave will cause the parent page to refresh as if the user
had clicked the reload button. Using client side script you could also
submit the parent page from the child page, or alter its controls.
 
G

Guest

mayb eI'm missing something. I still don't see where to trigger this. If what
you say is true then it must be triggered on the parent page. The pop-up is
closed by the user thus returning to that page. I don't know where that
trigger would be since I open the pop-up using:

btnxyz.Attributes.Add("onclick", "window.showModalDialog('../page.aspx',
'Dialog Arguments Value','dialogWidth: 490px; help:0; resizable:no;
center:yes; edge:sunken; status:no')")

also, if you reload on a new form (in my app) you are clearly the options
and field info.

so I'm wondering if there is a way to re-bind the dropdown each time the
dropdown is clicked/touched, thus showing the new option? Or something like
that. I can't do a post back in 1.1 since it will submit the form and I don't
want to do that yet. What I'm trying to do is common in windows forms.

thanx.
 
G

Guest

Back at this again. Question if I relad the page isn't that the same as
re-submitting it? I've read that if the refresh button is used it might post
the form?

Also, can you please explain how and where to add the Javascript relad you
spoke of. If the form above is model, and I close it. where would the code
run?

thanx.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top