Monday, August 16, 2010

Redirect AddForm.aspx,EditForm.aspx Page to custom page.

Bydefault SharePoint List AddForm.aspx and EditForm.aspx page redirect you to AllItem.aspx page when you click on "OK" or "Cancel" button.

If you want to redirect your AddForm.aspx and EditForm.aspx page to your custom page, here is the solution.

1) Open your AddForm.aspx page in SharePoint Designer.
2) Right click on SharePoint ListForm Webpart, go to webpart properties and hide webpart.
3) Add Custom List Form from Insert->SharePoint Control.
4)Select your list name and select your form (e.g New Item Form).
5)Comment save button().
6)Insert javascript with button like (<button id="savebutton1" name="Ok" onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={/Subsite/Pages/test.aspx}')}" style="width: 16px;" title="Ok" value="Ok"></button>)
 Or

<input name="btnSave" onclick="javascript: {ddwrt:GenFireServerEvent('__redirect={/subsite/Pages/test.aspx}')}" type="button" />
7)Save the page and check page is now redirect to your sprecified link.

Saturday, August 14, 2010

SharePoint Exception: No item exists [url]. It may have been deleted or renamed by another user.

This is one of the exception regularly comes when we do custom development and create custom aspx pages. Everything works fine and no code issues but still this exception comes.


Error occur as :- No item exists at http://sitename/pagename.aspx?Id=2.It may have been deleted or renamed by another user.


The issue can be easily solved by renaming the querystring parameter to a different name other than Id
(E.g http://sitename/pagename.aspx?empid=2).


After renaming the parameter the Sharepoint page will work as expected.


The issue occurs due to conflict of querystring parameter Id with sharepoint list Id.


Hope this helps and save you from killing so much time to know the problem.









Friday, August 13, 2010

Recover broken sharepoint list forms NewForm.aspx,EditForm.aspx.

If you've ever played around with any of the SharePoint list forms (NewForm.aspx, EditForm.aspx) in SharePoint Designer, then you may (probably) have been faced with broken links and a host of other errors that have rendered your forms, and quite probably your list, useless.

I faced similar problem in last month. I was spend around 1 day to re-correct that page, but no output. Luckily there's an easy way to fix this, its take hardly 5 min.


Here are the things you'll need to fix your forms:

  1. With the broken form page already open in SharePoint Designer, open any form that is NOT broken. This can be any form from from any list as long as it works.
  2. Remove ListFormWebpart from broken page  "<WebPartPages:ListFormWebPart ... to</WebPartPages:ListFormWebPart>"
  3. Copy ListFormWebPart from unbroken list page open in previous and paste it into the broken form.
  4. Paste the List GUID in &ltListName ... between the { and }.
  5. Generate a form GUID from Visual Studio or click on http://www.somacon.com/p113.php to generate GUID and paste it into the ... __WebPartID="{[Form GUID]}" > and the <ID>g_[Form GUID]</ID>.
  6. Save the page and refresh the list in your browser. The page should now be fixed.