Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have developed a portal using SharePoint 2010 (Standard Edition). I want to develop a Master-Detail "Requisition" form using Visual Studio 2010. I don't want users to access the List and click on "Add New" to access the form. I want to create a link on portal's homepage like "Requisition Form" when user will click on the link it should open the form right there.

Should I create a Visual WebPart ..then create new page and embed the webpart there? or should I develop WebPart Page..I've never done webpart page so what's the better approach? and to Edit the page do I need to create another Visual part with Gridview control and fill currently logged in user's Requisitions including Item ID and pass it on to MyCustomRequisitionEditForm.aspx ?

Please advise.

share|improve this question

1 Answer 1

If you want to get just a popup like in 'add new item' in SharePoint list, then you don't have to do any custom development, just reuse existing functionality.

You can add 'Content Editor' web part into page you want to have 'Requisition Form' button, and then, just insert html that you get from requisition list, code should look somehow like this:

<table id="Hero-WPQ2" width="100%" cellpadding="0" cellspacing="0" border="0" xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:sharepoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal">
<tbody>
<tr>
    <td colspan="2" class="ms-partline">
        <img src="/_layouts/images/blank.gif" width="1" height="1" alt=""/></td>
</tr>
<tr>
    <td class="ms-addnew" style="padding-bottom: 3px; ">
        <span class="s4-clust" style="height: 10px; width: 10px; position: relative; display: inline-block; overflow: hidden; ">
             <img src="/_layouts/images/fgimg.png" alt="" style="left: 0px !important; top: -128px !important; position: absolute; "/>
         </span>&#160;
         <a class="ms-addnew" id="idHomePageNewItem" href="http://serverUrl/_layouts/listform.aspx?PageType=8&ListId={1BFD1E8F-EFE8-47E0-9C2A-12936EBEB5B8}&RootFolder=" target="_self">Requisition Form</a>
     </td>
</tr>
<tr>
     <td>
         <img src="/_layouts/images/blank.gif" width="1" height="5" alt=""/>
     </td>
</tr>
</tbody>
</table>

​​​

share|improve this answer
    
Nice approach but what if I want a single aspx page like reqpage.aspx and displayed inside reqpage.aspx (without popup). I think i need to develop a Visual webpart and embed webpart there. –  user342944 Oct 30 '12 at 11:23
    
True, I can't figure out any quick and nice solution. Maybe adding "Forms Webpart" into page and adding iframe element into it with url pointing to this new list item page. But this would require some additional javascript coding, that would properly redirect after submitting this iframe form. Another thing would be trimming somehow ribbon in this nested page. I never tested something like this, but it seems like writing own webpart would be more robust approach. –  Marek Kembrowski Oct 30 '12 at 13:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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