“Submit” ASP.NET and SharePoint

One of my developers and I ran into an interesting problem today – we’d migrated a web site over to SharePoint 2007 (using a popular content migration tool) and found that all page postback calls in SharePoint were giving JavaScript errors, specifically:

Object doesn’t support property or method.

Turns out that our master page and page layouts contained input controls (text boxes) with name/id as “submit”.  Use of this reserved name sent ASP.NET’s JavaScript code into a tailspin and wrecked havoc with any postback submissions.

So, when you develop web sites in ASP.NET and/or SharePoint, be inventive with names for your buttons, text boxes and hidden fields – how about btnSubmit đŸ˜‰

I read somewhere else that naming the main ASP.NET form “default” is a no-no also.

2 thoughts on ““Submit” ASP.NET and SharePoint

  1. Emad Ibrahim

    Interesting, but can you elaborate on naming the main page “default”?… because the class name itself is _default but the page is default.aspx…

  2. robgarrett

    Emad,
    I only read about “default” in passing, so cannot give it any credence, I’m guessing that it’s not a good idea to give the main form an ID of “default”.

    R.

Comments are closed.