Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. refresh gridview on parent form after modal child form closed [modified]

refresh gridview on parent form after modal child form closed [modified]

Scheduled Pinned Locked Moved ASP.NET
helpjavascript
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    johland
    wrote on last edited by
    #1

    hi i've got a gridview on a parent webform. after closing a child form that was opened in modal mode i want the gridview to be refreshed. now i have tried several things that dont work and i dont know why: 1. tried to use: __doPostBack(buttonName,'') in javascript methode but nothing happened. this is the code i have used: code behind:

    protected void Page_Load(object sender, EventArgs e)
    {
    if (IsPostBack)
    return;
    //btnNewChore:the button that activates the modal dialog
    //btnRefresh: the button that shld activate the gridView refreshing

    btnNewChore.OnClientClick = "javascript:OpenChild( theURLOfTheChildForm, btnRefresh.ID)";

    }
    

    protected void btnRefresh_Click(object sender, EventArgs e)
    {
    gridViewChores.DataBind();
    }

    Javascript:

    function OpenChild(theURLOfTheChildForm,targetButton)
    {

        var winSettings = "center:yes;resizable:no;dialogHeight:300px"
        var returnValue = window.showModalDialog(URL, "", winSettings );
      
            if (returnValue == null)
            {
              window.alert("NO chore was created!");
            }
            else
            {
             \_\_doPostBack(btnName,'');
            }
    

    2.i've also tried to use document.all("btnRefresh").click(); instead of __doPostBack but i've got an error :document.all("... not an object etc... Thank you in advance for your help yohay

    modified on Monday, September 22, 2008 9:12 AM

    T K 2 Replies Last reply
    0
    • J johland

      hi i've got a gridview on a parent webform. after closing a child form that was opened in modal mode i want the gridview to be refreshed. now i have tried several things that dont work and i dont know why: 1. tried to use: __doPostBack(buttonName,'') in javascript methode but nothing happened. this is the code i have used: code behind:

      protected void Page_Load(object sender, EventArgs e)
      {
      if (IsPostBack)
      return;
      //btnNewChore:the button that activates the modal dialog
      //btnRefresh: the button that shld activate the gridView refreshing

      btnNewChore.OnClientClick = "javascript:OpenChild( theURLOfTheChildForm, btnRefresh.ID)";

      }
      

      protected void btnRefresh_Click(object sender, EventArgs e)
      {
      gridViewChores.DataBind();
      }

      Javascript:

      function OpenChild(theURLOfTheChildForm,targetButton)
      {

          var winSettings = "center:yes;resizable:no;dialogHeight:300px"
          var returnValue = window.showModalDialog(URL, "", winSettings );
        
              if (returnValue == null)
              {
                window.alert("NO chore was created!");
              }
              else
              {
               \_\_doPostBack(btnName,'');
              }
      

      2.i've also tried to use document.all("btnRefresh").click(); instead of __doPostBack but i've got an error :document.all("... not an object etc... Thank you in advance for your help yohay

      modified on Monday, September 22, 2008 9:12 AM

      T Offline
      T Offline
      ToddHileHoffer
      wrote on last edited by
      #2

      I had this same problem. I never found a solution, I ended up using window.redirect('samePage.aspx'); I had used the code in the modal window to save the parameters in session state. Then when the parent page reloaded it used the new parameters to bind the grid.

      I didn't get any requirements for the signature

      1 Reply Last reply
      0
      • J johland

        hi i've got a gridview on a parent webform. after closing a child form that was opened in modal mode i want the gridview to be refreshed. now i have tried several things that dont work and i dont know why: 1. tried to use: __doPostBack(buttonName,'') in javascript methode but nothing happened. this is the code i have used: code behind:

        protected void Page_Load(object sender, EventArgs e)
        {
        if (IsPostBack)
        return;
        //btnNewChore:the button that activates the modal dialog
        //btnRefresh: the button that shld activate the gridView refreshing

        btnNewChore.OnClientClick = "javascript:OpenChild( theURLOfTheChildForm, btnRefresh.ID)";

        }
        

        protected void btnRefresh_Click(object sender, EventArgs e)
        {
        gridViewChores.DataBind();
        }

        Javascript:

        function OpenChild(theURLOfTheChildForm,targetButton)
        {

            var winSettings = "center:yes;resizable:no;dialogHeight:300px"
            var returnValue = window.showModalDialog(URL, "", winSettings );
          
                if (returnValue == null)
                {
                  window.alert("NO chore was created!");
                }
                else
                {
                 \_\_doPostBack(btnName,'');
                }
        

        2.i've also tried to use document.all("btnRefresh").click(); instead of __doPostBack but i've got an error :document.all("... not an object etc... Thank you in advance for your help yohay

        modified on Monday, September 22, 2008 9:12 AM

        K Offline
        K Offline
        kenexcelon
        wrote on last edited by
        #3

        Is the other page that's being opened an aspx page? If it is, you can try declaring an object type of formview in the popups code behind. For ex. FormView fv = new FormView(); fv = (FormView)this.Parent.FindControl("NameOfFormView"); fv.DataBind(); However, I used AJAX's modalpopupextender on an ascx User Control that was on my page, so I hope it will work for you too. There is a possibility Parent may need to be in there more than once depending upon the levels.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups