Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6251457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:37:07+00:00 2026-05-24T13:37:07+00:00

does anyone know how to show the new list element form on button click,

  • 0

does anyone know how to show the new list element form on button click, that I have on my custom aspx page? Like when you have a sharepoint list and you click on “add item” and a new element form loads up in a new dialog window? I need the same thing to happen when I click on my button. I know how to do that in Sharepoint Designer, but I need to do it programmatically in visual studio. I assume Javascript must be involved in some way and I am terrible with it. Thaks in advance!

One more question – do you know of a way to refresh the original page, the one that has the button, upon closing of the dialog window?
Here is the scenario:

  1. I press the button,
  2. it opens the dialog window,
  3. I add an element to a Sharepoint list via it,
  4. I close the dialog window,
  5. I need the original page refreshed, so it repopulates the
    DropDownList and adds the title of this new list item to it.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T13:37:08+00:00Added an answer on May 24, 2026 at 1:37 pm

    The javascript code to achieve that varies with the type of list you are using (Tasks, document library, etc).

    To open a Sharepoint dialog window you can use the following javascript:

    var options = {
      url: '<url to the add item page>',
      title: '<Title of your Dialog>'
    }; 
    
    // add an event handler for the dialog closed callback
    options.dialogReturnValueCallback = Function.createDelegate(null, portal_modalDialogClosedCallback);
    
    void(SP.UI.ModalDialog.showModalDialog(options))
    
    function portal_modalDialogClosedCallback(result, value) {
        if(result === SP.UI.DialogResult.OK) { 
            //alert("OK was clicked");
        } 
        if(result === SP.UI.DialogResult.cancel) { 
            //alert("CANCEL was clicked");
        }
    
        window.frameElement.commitPopup(); // this will cause the list to refresh after the dialog closes
        // note: the above line only refreshes the List (which is the default Sharepoint OOB behavior anyway), to refresh the whole page use window.location.reload(); instead
    }
    

    The actual URL to use above varies with the type of list. Some examples:

    • Document Library-based: [url to your list, e.g. /Lists/MyList]/Forms/Upload.aspx
    • Announcements: [url to your list]/NewForm.aspx
    • Tasks: [url to your list]/NewForm.aspx

    Hope this helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know of a class in Java that has a list of elements,
Folks, Please does anyone know how to show a Form from an otherwise invisible
does anyone know how to make a GUI button open up a new JPanel
Does anyone know how to show a asp:TreeView always expanded to the leaves? So
Does anyone know of examples which show how to encrypt a dataset at the
Does anyone know tools which look at a MySQL database, show you all the
Does anyone know how to show the progress of archives extracting, when using chilkat?
Does anyone know the attributes or xml comments required to get the new EventHandler(blah);
I suspect I have corrupt mergeinfo but I'm not sure. Does anyone know how
Does anyone know where I could locate an english language word list in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.