0

I created a custom webpart for the newform of a list. So, I need to change the default url of add new item to my configured custom form page instead of default newform.aspx. I used SharePoint Designer, but it has some problem, so may I know the procedure to change url rather than the Designer?

2

You can change the NewForm by setting the DefaultNewFormUrl property of the List object:

using ( var ctx = new ClientContext( url ))
{
    var list = ctx.Web.Lists.GetByTitle( 'List' );
    list.DefaultNewFormUrl = newFormUrl;

    list.Update();
    ctx.Load( list );
    ctx.ExecuteQuery();
}

Make changes as needed. Not sure if the absolute url is required, or if a relative one can be used. And you may not need to load the list after the list.Update().

0

When in designer, go the the list view, and you will see a block that contians your forms. Click on the form you want as default, and at the top of the ribbon, there will be an option called "Set as Standard". Click that, and that view will now be your standard view.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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