"The event handler 'OnClick' is not allowed in this page."

When I goto site settings. Under the Provisioning Configuration, I click on Provisioning Groups

The following error is  displayed on the page

" An error occurred during the processing of . The event handler 'OnClick' is not allowed in this page. "

 

Where do i start?

Denzil Fernandes
TDBFG

www.td.com
Have more questions? Submit a request

7 Comments

  • 0
    Avatar
    Matthew McBride

    You will probably need to add your OnClick event handler as a delegate to the Click event on the link in your codebehind and remove the OnClick attribute in your .aspx page. For example, see below where the event handler is wired up to the event within the OnInit event handler.

    Client Code (.aspx)
    ----------------------
    <asp:LinkButton ID="authorize"  runat="server" >Authorize</asp:LinkButton>

    Codebehind (.cs)
    ---------------------
    namespace SPLibrary
    {
        public class Default : Microsoft.SharePoint.WebPartPages.WebPartPage
        {
            protected LinkButton authorize;

            protected override void OnInit(EventArgs e)
            {
                authorize.Click += new EventHandler(authorize_OnClick);
            }

            protected void authorize_OnClick(object sender, EventArgs e)
            {
                LinkButton authorize = FindControl("authorize") as LinkButton;
                authorize.Text = "Label Changed";
                // required business logic can be added.
            }
        }

    If you need to use client side script, remove the runat="server" attribute and you may need to change OnClick to OnClientClick.

    David Fisher
    Software Engineer
    SharePoint Solutions
  • 0
    Avatar
    Matthew McBride

    Strange but the built in master pages from MOSS are okay, example blueband.master etc. There seems to be an error with mine.

    Since I'm not a developer I can't try your suggestions. Because I will be modifying your AddProvProfWiz*.aspx page which has the Onclick event. This file is on several WFE machines

    Denzil Fernandes
    TDBFG

    www.td.com
  • 0
    Avatar
    Matthew McBride

    As I mentioned above a PageParserPath entry in your web.config file will correct this issue. Did you try this option?

    Jeremy Luerkens
    Manager, Software Production
    SharePoint Solutions
  • 0
    Avatar
    Matthew McBride

    Sorry, but I have other issues right now. I will attempt this as soon as I get the basic functionality working. for now I am using the default.master for the system master and my custom.master for the site master page.

    I will try and modify the web.config later this evening on both my WFE servers

    Denzil Fernandes
    TDBFG

    www.td.com
  • 0
    Avatar
    Matthew McBride

    <PageParserPaths>
     <PageParserPath VirtualPath="/*" CompilationMode="Always" AllowServerSideScript="true" IncludeSubFolders="true" /> 
    </PageParserPaths>

     

    After adding the above config to my web.config I was able to use my custom masterpage..

     

     


     

    Denzil Fernandes
    TDBFG

    www.td.com
  • 0
    Avatar
    Matthew McBride

    upon further investigation, this occurs when a custom "system master page" for the site is used. I've used this for all other sites with no problem.

    Denzil Fernandes
    TDBFG

    www.td.com
  • 0
    Avatar
    Matthew McBride

    When using a custom master page you may need a page parser path to allow this type of behavior.

    http://msdn.microsoft.com/en-us/library/ms562040.aspx

    Jeremy Luerkens
    Manager, Software Production
    SharePoint Solutions
Please sign in to leave a comment.