I made some custom list definitions in Visual Studio 2010 and deploy them to SharePoint 2010. I also made a Visual Web Part with a form. With this form I'm able to feed multiple of my lists with just that one form (it's done with a loop in C#). For now, the Visual Web Part with that form is opened in a Modal Dialog with the help of a custom button in the lists Ribbon-Menu (CustomAction).

But I would also like to open the form by clicking on the default "Add new item" link which is positioned under each list. I think it would be enough to change the "Onclick"-method to the function which is already on the button in the Ribbon-Menu. But how can I change the "Onclick"-method? Or do you know any other solution?

Thank you in advance for your help!

  • 1
    I just figured it out how to do it: in the SharePoint list, I went to "Default New Form" and added my web part. To not get an error message, the default web part with the default form must be "Closed", and not deleted. Anyway: if someone knows how to do that programmatically, it would be great. Thank you, Mike
    – Mike
    Jun 8, 2012 at 11:56
  • Mike, For future reference, it is always better to save your default newForm.aspx as something else like NewFormOne.aspx and then modify that one and set as your default form. You can just hide the default webpart and add your custom below it. That way it will stay in your forms list within SPDesigner allowing it to be set as default. Else you would need to accomplish setting it as default through Studio. (pain)
    – user9677
    Jul 25, 2012 at 19:43

1 Answer 1


A simplistic way to do it would be to figure out how to select that button, be it it's ID or CSS and use jQuery (or javascript) to set the on click. $('#NEwItemButtonsID').click(function(){ doOpen(); return false}); return false; stops the post back.

There might be a way to do it with manged code, but I am not sure.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.