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
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to ReFresh a user Control

How to ReFresh a user Control

Scheduled Pinned Locked Moved ASP.NET
csharpjavascriptasp-nettutorial
8 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.
  • V Offline
    V Offline
    Vimalsoft Pty Ltd
    wrote on last edited by
    #1

    i have a userControl and am using it in a aspx page, now i have expose the Following Method that reside in the usercontrol like this

    public void load\_Again()
    {
        string clientscript = "";
    
        // make available to all subcontrols a variable with the client ID of the textbox in which to store the selected activity IDs
        clientscript = "var txtbxActvClientID = '" + txtbxActvs.ClientID.ToString() + "'; ";
        // assign the current list of selected activities to the list for JavaScript here
        //clientscript += "var ActivityList = String(\\"" + txtbxActvs.Text + "\\"); ";  
        ClientScriptManager cs = Page.ClientScript;
        cs.RegisterClientScriptBlock(this.GetType(), "txtbxlookupid", clientscript, true);
        HighlightSelectedActvs();
    }
    

    and am calling it on my aspx page like this

    ActivityCtrl1.load_Again();

    i have Copied the code you see in the method load_Again() from the page load event of the Control. I want refresh or load the page again after i click a button in my aspx page. Thank you

    Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.tiyaneProperties.co.za vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

    D N 2 Replies Last reply
    0
    • V Vimalsoft Pty Ltd

      i have a userControl and am using it in a aspx page, now i have expose the Following Method that reside in the usercontrol like this

      public void load\_Again()
      {
          string clientscript = "";
      
          // make available to all subcontrols a variable with the client ID of the textbox in which to store the selected activity IDs
          clientscript = "var txtbxActvClientID = '" + txtbxActvs.ClientID.ToString() + "'; ";
          // assign the current list of selected activities to the list for JavaScript here
          //clientscript += "var ActivityList = String(\\"" + txtbxActvs.Text + "\\"); ";  
          ClientScriptManager cs = Page.ClientScript;
          cs.RegisterClientScriptBlock(this.GetType(), "txtbxlookupid", clientscript, true);
          HighlightSelectedActvs();
      }
      

      and am calling it on my aspx page like this

      ActivityCtrl1.load_Again();

      i have Copied the code you see in the method load_Again() from the page load event of the Control. I want refresh or load the page again after i click a button in my aspx page. Thank you

      Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.tiyaneProperties.co.za vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

      D Offline
      D Offline
      Deshbir Singh
      wrote on last edited by
      #2

      use button as asp:button and it will do a postback call where you can do whatever you want.

      Prince www.imaginethinkact.com

      V 1 Reply Last reply
      0
      • D Deshbir Singh

        use button as asp:button and it will do a postback call where you can do whatever you want.

        Prince www.imaginethinkact.com

        V Offline
        V Offline
        Vimalsoft Pty Ltd
        wrote on last edited by
        #3

        I really don't understand what you just wrote , can you please explain clearer ? :)

        Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.tiyaneProperties.co.za vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

        1 Reply Last reply
        0
        • V Vimalsoft Pty Ltd

          i have a userControl and am using it in a aspx page, now i have expose the Following Method that reside in the usercontrol like this

          public void load\_Again()
          {
              string clientscript = "";
          
              // make available to all subcontrols a variable with the client ID of the textbox in which to store the selected activity IDs
              clientscript = "var txtbxActvClientID = '" + txtbxActvs.ClientID.ToString() + "'; ";
              // assign the current list of selected activities to the list for JavaScript here
              //clientscript += "var ActivityList = String(\\"" + txtbxActvs.Text + "\\"); ";  
              ClientScriptManager cs = Page.ClientScript;
              cs.RegisterClientScriptBlock(this.GetType(), "txtbxlookupid", clientscript, true);
              HighlightSelectedActvs();
          }
          

          and am calling it on my aspx page like this

          ActivityCtrl1.load_Again();

          i have Copied the code you see in the method load_Again() from the page load event of the Control. I want refresh or load the page again after i click a button in my aspx page. Thank you

          Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.tiyaneProperties.co.za vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

          N Offline
          N Offline
          Nyoti Rukadikar
          wrote on last edited by
          #4

          ActivityCtrl1.load_Again(); Is this written on Page_Load of your aspx page?

          V 1 Reply Last reply
          0
          • N Nyoti Rukadikar

            ActivityCtrl1.load_Again(); Is this written on Page_Load of your aspx page?

            V Offline
            V Offline
            Vimalsoft Pty Ltd
            wrote on last edited by
            #5

            Yes and declared Public in the User Control

            Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.tiyaneProperties.co.za vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

            N 1 Reply Last reply
            0
            • V Vimalsoft Pty Ltd

              Yes and declared Public in the User Control

              Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.tiyaneProperties.co.za vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

              N Offline
              N Offline
              Nyoti Rukadikar
              wrote on last edited by
              #6

              Can you put this code (for LoadAgain()) inside the page load event of user control? If it is a dynamic user control, it needs to be regenerated on post back of page. Thanks & Regards, Nyoti

              V 1 Reply Last reply
              0
              • N Nyoti Rukadikar

                Can you put this code (for LoadAgain()) inside the page load event of user control? If it is a dynamic user control, it needs to be regenerated on post back of page. Thanks & Regards, Nyoti

                V Offline
                V Offline
                Vimalsoft Pty Ltd
                wrote on last edited by
                #7

                After the button has been clicked i have Forced a Postback by doing this

                response.redirect("Subjectscruct.aspx",false");

                and it worked, is this an efficient way ? Thank you

                Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.tiyaneProperties.co.za vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

                N 1 Reply Last reply
                0
                • V Vimalsoft Pty Ltd

                  After the button has been clicked i have Forced a Postback by doing this

                  response.redirect("Subjectscruct.aspx",false");

                  and it worked, is this an efficient way ? Thank you

                  Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.tiyaneProperties.co.za vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

                  N Offline
                  N Offline
                  Nyoti Rukadikar
                  wrote on last edited by
                  #8

                  If the button is in the page, I am not sure why it was needed to execute Postback forcefully? Did you try debugging on the page load on the click of button to check if the control comes there? Thanks, Nyoti

                  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