943,928 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 2013
  • ASP.NET RSS
Apr 22nd, 2009
0

Refreshing a dropdownlist in a FormView Template

Expand Post »
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!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
da_tikboy is offline Offline
2 posts
since Oct 2008
Apr 22nd, 2009
0

Re: Refreshing a dropdownlist in a FormView Template

found this:
In your modal
ASP.NET Syntax (Toggle Plain Text)
  1.  
  2.  
  3.  
  4. window.returnValue = "doReload";
  5. window.close();
Then in your mainpage
ASP.NET Syntax (Toggle Plain Text)
  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!
Reputation Points: 22
Solved Threads: 9
Junior Poster
ninjaimp is offline Offline
129 posts
since Apr 2008
Apr 25th, 2009
0

Re: Refreshing a dropdownlist in a FormView Template

Hi,

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

ASP.NET Syntax (Toggle Plain Text)
  1. window.opener.refresh();

or

You can try like this

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

in parent page:
ASP.NET Syntax (Toggle Plain Text)
  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.
Reputation Points: 25
Solved Threads: 29
Posting Whiz
greeny_1984 is offline Offline
372 posts
since Apr 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Your login attempt was not successful. Please try again PROBLEM
Next Thread in ASP.NET Forum Timeline: Forms Authentication





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC