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. Using Ajax control in User Control (ascx) [modified]

Using Ajax control in User Control (ascx) [modified]

Scheduled Pinned Locked Moved ASP.NET
helptools
11 Posts 2 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.
  • M Muc_

    Tach experts .. I have ne problem where I do not know to solve that... I have a control that is added in a page. Basically it is a Content Management System. It selects a new page and can add different controls. In the control itself, I use a ModalPopupvon Ajax, but who needs a script manager. Now I wonder whether in the side where the control is already added a ScriptManager exists otherwise I add one. Here

    void AddScriptMagnager()
    {
    //get the existing ScriptManager if it exists on the page

            ScriptManager \_scriptMan = ScriptManager.GetCurrent(this.Page); 
    
            if (\_scriptMan == null)
            {
                //create new ScriptManager and EnablePartialRendering or whatever
                \_scriptMan = new ScriptManager();
                \_scriptMan.EnablePartialRendering = true;
                \_scriptMan.EnableScriptLocalization = true;
    
                if (this.MuMPage.Page.Form != null)
                {
                    foreach (Control ctrl in this.MuMPage.Page.Form.Controls)
                    {
                      this.MuMPage.Page.Controls.Add(\_scriptMan);
                    }                    
                }
            }
        }
    

    I always get the error that a Extendersteuerelemente may not be registered before PreRender. I appreciate any help and thanks a lot in advance.

    modified on Monday, June 21, 2010 9:02 AM

    N Offline
    N Offline
    Not Active
    wrote on last edited by
    #2

    [CODE] There is a defined tag for this, <pre> implemented by clicking the "code block" toolbar item directly above this textarea. Please correct your post and read the posting guidelines for this site.


    I know the language. I've read a book. - _Madmatt

    1 Reply Last reply
    0
    • M Muc_

      Tach experts .. I have ne problem where I do not know to solve that... I have a control that is added in a page. Basically it is a Content Management System. It selects a new page and can add different controls. In the control itself, I use a ModalPopupvon Ajax, but who needs a script manager. Now I wonder whether in the side where the control is already added a ScriptManager exists otherwise I add one. Here

      void AddScriptMagnager()
      {
      //get the existing ScriptManager if it exists on the page

              ScriptManager \_scriptMan = ScriptManager.GetCurrent(this.Page); 
      
              if (\_scriptMan == null)
              {
                  //create new ScriptManager and EnablePartialRendering or whatever
                  \_scriptMan = new ScriptManager();
                  \_scriptMan.EnablePartialRendering = true;
                  \_scriptMan.EnableScriptLocalization = true;
      
                  if (this.MuMPage.Page.Form != null)
                  {
                      foreach (Control ctrl in this.MuMPage.Page.Form.Controls)
                      {
                        this.MuMPage.Page.Controls.Add(\_scriptMan);
                      }                    
                  }
              }
          }
      

      I always get the error that a Extendersteuerelemente may not be registered before PreRender. I appreciate any help and thanks a lot in advance.

      modified on Monday, June 21, 2010 9:02 AM

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #3

      Add where are you calling the AddScriptManager method? Obviously no in the PreRender event handler. The common implementation is to include a ScriptManger in the master page so it is not necessary to be included in child pages and is available for use.


      I know the language. I've read a book. - _Madmatt

      M 1 Reply Last reply
      0
      • N Not Active

        Add where are you calling the AddScriptManager method? Obviously no in the PreRender event handler. The common implementation is to include a ScriptManger in the master page so it is not necessary to be included in child pages and is available for use.


        I know the language. I've read a book. - _Madmatt

        M Offline
        M Offline
        Muc_
        wrote on last edited by
        #4

        but what shall i do if there is none available in the master page?

        N 1 Reply Last reply
        0
        • M Muc_

          but what shall i do if there is none available in the master page?

          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #5

          You wrote the master page correct? Add a ScriptManager! If you did not write the master page then the author probably did not intend for Ajax to be used in this manner


          I know the language. I've read a book. - _Madmatt

          M 1 Reply Last reply
          0
          • N Not Active

            You wrote the master page correct? Add a ScriptManager! If you did not write the master page then the author probably did not intend for Ajax to be used in this manner


            I know the language. I've read a book. - _Madmatt

            M Offline
            M Offline
            Muc_
            wrote on last edited by
            #6

            Nope, i c´ant! This is Standart site for everysite inour CMS. I'm trying to do exactly that! Just when none is there in the page where I try to add the control at runtime and add a Script Manager. And i get Collection was modified; enumeration operation may not execute.

            M 1 Reply Last reply
            0
            • M Muc_

              Nope, i c´ant! This is Standart site for everysite inour CMS. I'm trying to do exactly that! Just when none is there in the page where I try to add the control at runtime and add a Script Manager. And i get Collection was modified; enumeration operation may not execute.

              M Offline
              M Offline
              Muc_
              wrote on last edited by
              #7

              HELLO, I now have a template contains a script manager. but I get this error message but still Extender controls may not be registered after PreRender

              N 1 Reply Last reply
              0
              • M Muc_

                HELLO, I now have a template contains a script manager. but I get this error message but still Extender controls may not be registered after PreRender

                N Offline
                N Offline
                Not Active
                wrote on last edited by
                #8

                HELLO, the error tells you what to do


                I know the language. I've read a book. - _Madmatt

                M 1 Reply Last reply
                0
                • N Not Active

                  HELLO, the error tells you what to do


                  I know the language. I've read a book. - _Madmatt

                  M Offline
                  M Offline
                  Muc_
                  wrote on last edited by
                  #9

                  but what is the right event to put into?

                  N 1 Reply Last reply
                  0
                  • M Muc_

                    but what is the right event to put into?

                    N Offline
                    N Offline
                    Not Active
                    wrote on last edited by
                    #10

                    Can you do nothing on your own? Go to the address bar of your browser and type, www.google.com, then click GO.


                    I know the language. I've read a book. - _Madmatt

                    M 1 Reply Last reply
                    0
                    • N Not Active

                      Can you do nothing on your own? Go to the address bar of your browser and type, www.google.com, then click GO.


                      I know the language. I've read a book. - _Madmatt

                      M Offline
                      M Offline
                      Muc_
                      wrote on last edited by
                      #11

                      is already done! thxs for your helps.

                      modified on Tuesday, June 22, 2010 3:12 AM

                      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