1

I would like to have submission feature on the List

enter image description here

List structure would be

enter image description here

Mon-Fri is considered as a week, user would be asked to select the current week's Friday from the calendar.

It would be nice to show only the details of the currently logged in user(Specify which items users are allowed to create and edit - settings may be used) for the current week.

I know, two questions are combined here as those are interrelated.

2

I can think of 2 possible ways to achieve this:

  1. Create a separate Web Part with your form only, and add that web part in the same page as the XsltListViewWebPart.
  2. Create a custom Web Part in Visual Studio that has both the form AND the XsltListViewWebPart. You can override the CreateChildControls (and other methods) to have both components coexisting in the same custom Web Part.

Custom WebPart: http://msdn.microsoft.com/en-us/library/dd583168(v=office.11).aspx Programmatically adding XsltListViewWebPart: Creating an XsltListViewWebPart programmatically: Columns & toolbar

Regarding limiting the items, there's an option in any list to "only show items created by the user". http://social.technet.microsoft.com/Forums/sharepoint/en-US/318d300e-5cca-4aa7-afdb-ba3ab5a467cf/how-to-set-permissions-so-that-users-can-only-seeedit-thier-own-items-on-a-list?forum=sharepointgeneralprevious

[Update: extending the "Custom Web Part" idea] You are on the right track here: Reusing the XsltListViewWebPart

The idea is that you add BOTH the Form user control and the XSLT List View Web Part to a custom web part (let's call it ListViewFormWebPart).

When the user clicks "Submit" on the Form, the postback is fired and you can refresh the XSLT List View Web Part on the "Button_Click" event.

To avoid a full page refresh, you can wrap everything in an UpdatePanel.

Regarding the point about hiding the "Add New Item", you can easily achieve that with CSS or jQuery, or with other alternatives as shown here: Hide the "Add new Item" option below the sharepoint 2010 list

  • 1
    separate WebPart should be fine? however how can I handle the submit event? would that be like adding item on the list using server side code or may be something like with spservices? Idea is to allow the user to add rows as many as want and let him submit at once. – Karthikeyan May 4 '14 at 6:30
  • 1
    razafayyaz.com/2012/11/using-webpart-to-insert-data-into.html seems to be a good start. – Karthikeyan May 4 '14 at 16:53
  • 1
    If you create a separate web part for the submission of the form, you'll be able to handle the submit event either on the code behind, or you can use CSOM as well. The only challenge would be to asynchronously refresh the ListViewWebPart with the list items below. For that reason only, I might consider the "joint" web part with both form and view, so that after the user submits, you can refresh the data in the "connected" view. Makes sense? – Amadeo Gallardo May 5 '14 at 0:02
  • yes, it does. I can handle the list update event on the sumbit event however how can I refresh the XSLTListViewwebpart? can you help me with the sample code snippet. – Karthikeyan May 5 '14 at 0:30
  • Check the edits... – Amadeo Gallardo May 5 '14 at 23:22

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.