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:
- I press the button,
- it opens the dialog window,
- I add an element to a Sharepoint list via it,
- I close the dialog window,
- I need the original page refreshed, so it repopulates the
DropDownList and adds the title of this new list item to it.
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:
The actual URL to use above varies with the type of list. Some examples:
[url to your list, e.g. /Lists/MyList]/Forms/Upload.aspx[url to your list]/NewForm.aspx[url to your list]/NewForm.aspxHope this helps