Refreshing a dropdownlist in a FormView Template

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2008
Posts: 2
Reputation: da_tikboy is an unknown quantity at this point 
Solved Threads: 0
da_tikboy da_tikboy is offline Offline
Newbie Poster

Refreshing a dropdownlist in a FormView Template

 
0
  #1
Apr 22nd, 2009
I have a FormView InsertItemTemplate which has a databound dropdownlist. The dropdownlist displays a list of names retrieved through a SQL Server stored proc. The user has an option to add a new name to the database by clicking a button next to the dropdownlist. Clicking the button fires a javascript function, which opens a modal window. This "popup" window is where a new name and other pertinent data is entered. When the modal window closes the dropdownlist needs to refresh in order to display the new name (which was just entered in the modal window).

What is the best approach to refresh the dropdownlist? Where and when should a refresh occur (in what event)?

Thanks for your help!
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 115
Reputation: ninjaimp is an unknown quantity at this point 
Solved Threads: 6
ninjaimp ninjaimp is offline Offline
Junior Poster

Re: Refreshing a dropdownlist in a FormView Template

 
0
  #2
Apr 22nd, 2009
found this:
In your modal
  1.  
  2.  
  3.  
  4. window.returnValue = "doReload";
  5. window.close();
Then in your mainpage
  1.  
  2.  
  3. var modal = window.showModal....
  4. if (modal == "doReload") {
  5. window.location = window.location;
  6. }

its in c but it can hopefully give you a starting point on where to research!
Please mark this post as 'Solved' if it has helped and fixed your issue.
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 370
Reputation: greeny_1984 is an unknown quantity at this point 
Solved Threads: 29
greeny_1984's Avatar
greeny_1984 greeny_1984 is offline Offline
Posting Whiz

Re: Refreshing a dropdownlist in a FormView Template

 
0
  #3
Apr 25th, 2009
Hi,

Where did you bind the dropdownlist it have binded the dropdownlist in page load you can use this javascript

  1. window.opener.refresh();

or

You can try like this

in child page
  1. ClientScript.RegisterStartupScript(this.GetType(), "msg", "alert(' Details Added Successfully!');window.close();window.opener.__doPostBack('ChildWindowPostBack', '');", true);

in parent page:
  1. this.ClientScript.GetPostBackEventReference(this, string.Empty);
  2.  
  3. if (this.IsPostBack)
  4. {
  5. string eventTarget = (this.Request["__EVENTTARGET"] == null) ? string.Empty : this.Request["__EVENTTARGET"];
  6.  
  7. if (eventTarget == "ChildWindowPostBack")
  8. {
  9. //bind the dropdownlist
  10. }
  11. }
  12. }
Last edited by peter_budo; Apr 25th, 2009 at 9:41 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
If u r query is achieved,mark the thread as solved

Live and Let Live
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC