Custom List Form - newform.aspx with code behind - beginner

Hi,
I am working on a request whereby I have to customize the NewForm.aspx. The form will have roughly about 30 controls. One of the controls on the form will pull data from a web service. Another will pull data from a sharepoint list, this is quite complex
as there will be some logic involved. The form data will then be input as the items into the Main SharePoint list.
I do know that there will be some code behind on the custom NewForm.aspx, and that it has to be done on Visual Studio.
I am confused between the application page, custom form web part, or is there any others missing out. Which one of this the best practice, also can someone point out some msdn articles. I found some on the Net, but I find the guides too complicated and am
finding it difficult to understand. 
Please help

It depends on how your users will interact with the list, are they going to use list newform.aspx to submit the data or will you be providing separate interface to submit the data. You can always go with custom webpart to incorporate all your business logic
along with the interface required for end users.
building custom webparts in SharePoint 2010
http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2010/02/15/intro-to-sharepoint-2010-development-how-to-build-and-deploy-a-web-part.aspx
Custom List form
http://blog.karstein-consulting.com/2010/12/29/walkthrough-create-custom-sharepoint-2010-list-form-for-deployment-in-a-visual-studio-2010-project/
My Blog- http://www.sharepoint-journey.com|
If a post answers your question, please click Mark As Answer on that post and Vote as Helpful

Similar Messages

  • Infopath 2010 Web Form will not run code behind or load External Lists after FormEvents_Loading added

    Building a form to edit and create data in external list. The business rules do not allow for creation in an external list bound InfoPath form. (We are cascade filtering multiple drop down lists from external content type).
    All works to write code behind to push new record or update record in external list. The big issue came when trying to add FormEvents_loading event to the code to capture URL parameter. I want to be able to pass the Primary Key of the record to
    edit, load the data into the form and allow editing and submit. I have tested by manually entering the data and the form works. The form will no longer load data from external lists for the drop downs and shows an error stating "The custom code
    in the form cannot be run. This functionality may be deactivated
    on the server. For more information, contact the server farm administrator."
    I think this is related to moving from the normal forms services into sandboxed code service. Is there a way to access external content types and still have form loading event capture URL parameters?
    The code to capture the URL is listed below:
    XPathNavigator myNav1 = this.MainDataSource.CreateNavigator();
    string InputF1 = string.Empty;
    if (e.InputParameters.ContainsKey("AuthPK"))
    InputF1 = e.InputParameters["AuthPK"];
    myNav1.SelectSingleNode("/my:myFields/my:CodeData/my:DatabaseUpdateStatus", this.NamespaceManager).SetValue(InputF1);
    myNav1.SelectSingleNode("/my:myFields/my:CodeData/my:pk_tblOFCAuthorizations", this.NamespaceManager).SetValue(InputF1);
    else
    myNav1.SelectSingleNode("/my:myFields/my:CodeData/my:pk_tblOFCAuthorizations", this.NamespaceManager).SetValue("0");
    Is there another way to pass parameters to the form? I tried using web part connection, but that does not work with code behind form at all, which would stop me from updating external list.

    Hi,
    As this question is more related to InfoPath development, I suggest you post it to Visual Studio Tools for Office (VSTO) Forum, more experts will assist you with this issue.
    Visual Studio Tools for Office (VSTO) Forum:
    http://social.msdn.microsoft.com/Forums/en-US/home?forum=vsto
    Best Regards,
    Lisa Chen
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]

  • Custom Master Page with Code behind in SharePoint 2013

    Hi All,
    I want to create the Custom Master Page in Sharepoint 2013 with Code file in it.
    Is it possible to create? if YES the how i can achieve it??
    PD

    To add something to Amit's reply, you can refer to the following link on how to create master page with code behind if you are new to ASP.net.
    Walkthrough: Creating and Using ASP.NET Master Pages in Visual Web Developer
    http://msdn.microsoft.com/en-us/library/ehszf8ax(v=vs.90).aspx
    Miles LI TechNet Community Support

  • SP Designer 2010 - Saving custom list form impacts other list and other custom list form

    Hi,
    I have a source list, with custom display, edit and new forms all of them created in SP Designer 2010. These do nothing fancy, just for presentation purposes, fields were re-arranged in 2 columns.
    Then I created a target list by saving the source list as template, the template brought over all customizations, all seemed to work fine. So I started to modify the target custom list forms.
    Now here's the problem:
    After a while making changes to the target list I realized that somehow the custom list forms on the source list had been modified... so I opened the source list in designer and noticed that the out of the box forms: NewForm.aspx, DispForm.aspx, EditForm.aspx
    were now the default forms for the source list, and I couldn't pick my custom list forms to be the default forms for the source list anymore, they were not on the listbox. I could still see them by going in designer to All Files > Lists > SourceList
    > and if I previewed them, they were empty. 
    I believe that somehow source and target list are linked, but why would designer allow making changes to the source list? like resetting the default forms, and breaking up the custom list forms that were in place?
    I've verified list id's in the custom list forms of the target list and they belong to the GUID of the target list. I don't see anything else that could potentially point to the source list.
    SharePoint Designer 2010 version: 14.0.7007.1000 SP2 14.0.7015.1000 I don't think this matters much because I've tried with other SP Designer 2010 versions and the error is the same.
    thanks for your reply!

    Hi alec,
    When I create a custom EditForm1.aspx and set as default for a source list, then save this list as a template, then the newly created the target list based off this saved template, the source list still uses the custom EditForm1.aspx form as default
    form, from SharePoint designer, I can see these two lists have different listID, so they have no connection when I edit any one of them.
    Please recreate a new list with custom form page and save as template, then create a new list see if this issue could be reproduced, or we can create a new list instead if it is an isolate issue.
    Thanks,
    Daniel Yang
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Daniel Yang
    TechNet Community Support

  • Created By and Created Date fields not showing up on Custom List form webpart

    Hi,
    I have added Custom Listform WebPart on "DispForm.aspx" of custom list. I need to display, out of box fields "Author" [Created By] and "Created" [Creation Date] on this custom list form webpart, I have added them on the webpart, following is the code behind of aspx page:
    <td width ="400px" valign= "top" class="ms-formbody">
    <xsl: value-of select = "@Author" disable-output-escaping = "yes"/>
    </td>
    However these fields are not showing/populating data on the form ?? Any inputs ???
    Regards

    Hi,
    I think that when you insert a custom list form web part you select “Item” content type, so custom list form is designed to display only the fields that are appropriate for that content type “Item”, but the item content type doesn’t contain the created and created by column, when you add the two columns, it will not find the field value. By default, the two columns will display at the foot of the list form using SharePoint:CreatedModifiedInfo.
    Hope it can help you.
    Xue-Mei Chang

  • User message entered in Validation settings does not show up in custom list form created in sharepoint designer 2010

    I have a custom list form created in SPD based on EditItem form.  I then set field validation in Validation setting and entered a user message to display when the validation did not pass.
    The validation works in the custom form but the user message never show up.
    I see a similar question posted in 2012:  
    https://social.technet.microsoft.com/Forums/en-US/cd292b50-856f-4dfa-8cfe-aeb688ee7185/validating-fields-on-a-sharepoint-2010-custom-list-form?forum=sharepointgeneralprevious 
    Is this still a known bug?   What is the easiest workaround?

    Hi ,
    From the
    above link you mentioned, have you tried using the code line in your custom form?
    Please try the code suggested by sp-achiever and hamish, and see if it could help solve the issue.
    <SharePoint:ItemValidationFailedMessage ControlMode="New" runat="server" ID="checkform" />
    Have you installed hotfix KB245789 or CU contained this kb?
    Please check if KB245789 has fixed this issue as KP2011 suggested in the same post, and please try it in a test environment firstly.
    http://support.microsoft.com/kb/2405789
    Thanks,
    Daniel Yang
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you havefeedback for TechNet Subscriber Support, contact [email protected] 
    Daniel Yang
    TechNet Community Support

  • How to add .js link in custom list form through sharepoint designer 2013

    hi friends
    so far i was adding jquery code to script editor webpart in custom list form.
    but i need to know how to add .js link in custom list form through sharepoint designer 2013
    please help me.

    Hi,
    We can add the "JS Link Property" in the “WebPart” node in the custom list form page through SharePoint designer 2013.
    Here is an example for your reference:
    <JSLink xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">~site/Style Library/js/custom.js</JSLink>
    Noticed that, we should not lose the 'xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm' attribute.
    Best Regards
    Dennis Guo
    TechNet Community Support

  • How to have digital signature in a Sharepoint 2013 custom list form created in InfoPath 2013?

    I have a requirement that they want a form in SP13 that would allow Mobile mode.  Supervisor then can sign off the form in mobile mode.  Because Document Library form doesn't have Mobile client support so I decided to create this as a custom List
    form.  Now I'm finding out that when I right click on the section on the form to enable e-signature, there is no such option.   I appreciate it if someone can give me some suggestion on how to have a form that has both Mobile mode and e-signature
    support in SP13.
    I also noticed that the people picker doesn't work in Mobile mode.  Is that so or is there something-else I need to configure?
    Thank you.

    Hi,
    According to your description, my understanding is that you want to create an InfoPath form which supports Mobile mode and e-signature in SharePoint 2013.
    Per my knowledge, the browser-based forms cannot support signature in Mobile device.
    Here are some other products which are not free can achieve this goal for you to take a look:
    http://forums.qdabra.com/2013/06/signing-infopath-forms-part-1-electronic-signatures/
    http://www.formotus.com/16563/infopath-alternatives/infopath-forms-filling-weigh-the-options
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • Extending component with code behind

    Hi,
    I have read an article about extending components with code
    behind:
    http://www.adobe.com/devnet/flex/quickstart/building_components_using_code_behind/
    I have a question about that. Maybe someone can help me.
    Example:
    {components/CartClass.as}
    package components
    public class CartClass extends DataGrid
    public function CartClass()
    super();
    {components/Cart.mxml}
    <?xml version="1.0" encoding="utf-8"?>
    <shop:CartClass xmlns:mx="
    http://www.adobe.com/2006/mxml"
    xmlns:shop="components.*"
    >
    </shop:CartClass>
    Everthing works fine but when i add:
    <mx:columns>
    <mx:DataGridColumn headerText="Title" />
    </mx:columns>
    between the shop:CartClass tag, Flex says:
    Could not resolve <mx:columns> to a component
    implementation
    Anyone knows why?

    "sjerry-" <[email protected]> wrote in
    message
    news:gcq38m$1rg$[email protected]..
    > Hi,
    >
    > I have read an article about extending components with
    code behind:
    >
    http://www.adobe.com/devnet/flex/quickstart/building_components_using_code_behin
    > d/
    >
    > I have a question about that. Maybe someone can help me.
    >
    > Example:
    > {components/CartClass.as}
    > package components
    > {
    > public class CartClass extends DataGrid
    > {
    > public function CartClass()
    > {
    > super();
    >
    > }
    > }
    > }
    >
    >
    > {components/Cart.mxml}
    > <?xml version="1.0" encoding="utf-8"?>
    > <shop:CartClass xmlns:mx="
    http://www.adobe.com/2006/mxml"
    > xmlns:shop="components.*"
    > >
    >
    > </shop:CartClass>
    >
    > Everthing works fine but when i add:
    > <mx:columns>
    > <mx:DataGridColumn headerText="Title" />
    > </mx:columns>
    >
    > between the shop:CartClass tag, Flex says:
    > Could not resolve <mx:columns> to a component
    implementation
    columns is actually a property of the DataGrid instance,
    rather than the
    DataGrid class itself, so it needs to be in the same
    namespace as the actual
    DataGrid subclass:
    <shop:columns>
    <mx:DataGridColumn headerText="Title" />
    </shop:columns>

  • Create Custom list form and validate fields using sharepoint designer 2010

    Hi All,
    I have a requirement to create a custom job application form which will be filled and submitted by anonymous users. I have a an option to create custom user control web part but I wanted to
    create it using custom list form using SharePoint designer. My requirement is below
    Date of birth (user age should be above 22yrs )
    Email Validation
    Phone validation
    Resume attachment (should attach only word documents or PDF)
    Qualification (If other is selected then show textbox else hide)
    Can above validations be done using SharePoint designer (JavaScript or validation controls)? Or do I have to create custom control web part?
    MercuryMan

    Hello,
    I think jquery/javascript can be used to put validations on those fields. Fortunately some of validation can be done via sharepoint itself like: email, phone, age. For Attachment and Qualification fields use jquery/JS.
    See below link for column validations:
    http://thechriskent.com/2012/08/15/validate-phone-number-columns-in-sharepoint/
    http://sharepointsolutions.com/sharepoint-help/blog/2011/12/how-to-validate-an-email-address-using-column-validation-in-sharepoint-2010/
    See this for attachment:
    http://stackoverflow.com/questions/4234589/validation-of-file-extension-before-uploading-file
    For qualification:
    http://sharepoint.stackexchange.com/questions/88064/hide-show-field-on-list-form-based-on-value-from-another-field
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see<br/> Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • Issue with dropdown menu on Custom List Form

    Hello everyone,
    Recently I created a custom list with a few lookup columns in it. When I open the form in Internet Explorer 9 or 10, the dropdowns pertaining to the lookup columns are extremently wide, even though each dropdown only contains 2 characters. However,
    if I open the form in Google Chome, and Firefox, the dropdowns are displayed properly.
    IE 9 Dropdown:
    Chrome Dropdown:
    If anybody has run into this issue and can point me in the right diretion, I will appreciate it. Thank you
    Fausto Capellan, Jr - SharePoint Admin

    Hi Fausto,
    According to your description, my understanding is that the drop-down list boxes of the lookup column became wide when using IE 9 or 10.
    Did you customize the list form in InfoPath?
    Per my test, the width of the drop-down list boxes can be customized in InfoPath.
    I tested in my environment, and the lookup column worked fine in IE 9 or 10.
    I recommend to add the SharePoint site to Compatibility View in IE to see if the issue still occurs.
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • Customize Access Requried page with code behind attached to it in sharepoint 2010

    Hi,
    I have modified default AccessDenied page to my custom accessdenied.aspx page and put Request Access button on it and javascript client side redirection to my requestaccess (reqestaccess.aspx, reqestaccess.aspx.cs) application page.
    Here the problem is whenever i try to redirect to custom requesaccess page in _layouts it again shows me accessdenied page since user is not having access.
    I changed requrestaccess to my custom requestaccess through Powershell command (UpdateMapping - 5). I can only modify the UI part of requestaccess.aspx and can not bind code behind where i want user to select combination of what access is required
    on the site, there are lots of controls on requestaccess page e.g. dropdown that fetches data from list\external list and so on.
    I tried many things to attach code behind to requestaccess page e.g. <%@ Page Inherits="codebehind.cs" /> and all.
    Q - How can i redirect user to custom request access page (includes both aspx, aspx.cs) and allow user to interact with custom page? Is there any way OR WORKAROUND to do this in Sharepoint 2010?
    OR
    Can we overide with ElevetedPermissions in UI\CodeBehind and show the application page to user?
    OR
    Can user access application page even though they donot have rights to access site? Anything will do.
    OR
    In short, I need to redirect a user to some .aspx\.aspx.cs page from AccessDenied page, irrespective of user having access or not. 
    I hope question is clear enough to understand the issue. :)
    Regards,
    Rahul

    Hi,
    According to your post, my understanding is that you had an issue about the custom Access Required page.
    Microsoft supported using code behind, but for these pages it seemed some difference.
    However, as a workaround, we can put all the functionality to the aspx page directly.
    http://umbraes-tower.blogspot.com/2011/10/custom-request-access-page-in.html
    More reference:
    http://onlinecoder.blogspot.com/2011/05/how-to-customize-requestaccess.html
    http://oszakiewski.net/eric/customizing-the-access-request-page-in-sharepoint-2010
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • Custom List Form creation using Powershell - SharePoint 2013

    Hi,
    I have a custom List called 'IssuesList' with 4 fields - "IssueTitle","IssueID","IssueDesc","Status"
    While displaying display form I should show 3 fields expect Issue ID i.e. IssueID should be hidden.
    and on edit form only Status field should be editable. So using SharePoint designer I created respective Edit form and display forms and changed XSLT to control the display mode on the fields.
    I have everything scripted in powershell till now - creation of custom list, publishing pages, webparts etc. however I am looking for how to provision or associate these 2 list forms with IssuesList after I create the list in new site.
    I have restrictions on using wsp and site/list template due to business needs. So I need to know if there is any way I can upload these 2 files after I create custom list in powershell and associate them as defaultdisplay and defauteditforms?
    Please advise.

    Hi,
    Per my understanding, you might need to apply these custom forms to a list after list creation using PowerShell.
    With PowerShell with SharePoint Object Model, we can hide fields on list forms.
    The similar thread below with code snippet will provide more information about this:
    https://social.technet.microsoft.com/Forums/en-US/ee6fc2eb-197f-4144-94fa-8a4e438675d9/hide-a-field-from-edit-form-list?forum=sharepointgeneralprevious
    If there may be other requirements except for hiding fields, as you have limitation on using custom solution package(which should be preferable in such scenario),
    a workaround I can provide is that, after list creation, you can add Content Editor Web Part contains the CSS style or JavaScript to the form pages of a specific list, it will help you hide/disable the specific elements, this can be achieved programmatically.
    The code below can add a Content Editor Web Part to the DisplayForm of a list(though in C#):
    public static void AddCEWP()
    SPLimitedWebPartManager manager = null;
    SPFile file = null;
    using (SPSite site = new SPSite("http://sp"))
    using (SPWeb web = site.RootWeb)
    try
    web.AllowUnsafeUpdates = true;
    file = web.GetFile(web.Url + "/Lists/List018/DispForm.aspx");
    manager = file.GetLimitedWebPartManager(PersonalizationScope.Shared);
    ContentEditorWebPart webPart = new ContentEditorWebPart();
    XmlDocument xmlDoc = new XmlDocument();
    XmlElement xmlElement = xmlDoc.CreateElement("HtmlContent");
    //xmlElement.InnerText = "<strong>Hello World!</strong>";
    //write the custom CSS style or JavaScript here
    string content = "<style>your custom style here...</style>";
    xmlElement.InnerText = content;
    webPart.Content = xmlElement;
    manager.AddWebPart(webPart, "Top", 0);
    manager.SaveChanges(webPart);
    web.Update();
    catch (Exception ex)
    //Utility.SPTraceLogError(ex);
    finally
    if (manager != null)
    manager.Dispose();
    web.AllowUnsafeUpdates = false;
    About how to hide fields on Standard List Forms using jQuery:
    http://social.technet.microsoft.com/wiki/contents/articles/21730.sharepoint-2010-conditionally-hide-fields-on-standard-list-forms-using-jquery.aspx
    http://stackoverflow.com/questions/10010405/how-to-hide-a-field-in-sharepoint-display-form-based-on-the-field-name-jquery
    Thanks
    Patrick Liang
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support,
    contact [email protected]
    Patrick Liang
    TechNet Community Support

  • How to change a field to mandatory in custom list form in SharePoint designer 2010?

    I need to create a custom form for a list, e.g. custom edit form. several fields are not mandatory by default, but in the custom edit form I need to make them mandatory. Is there a way to do that in SPD 2010?

    Hi,
    Thank you for sharing this with us, and it will help others who have met with this issue.
    Victoria
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Victoria Xia
    TechNet Community Support

  • SharePoint Custom New Form with DataForm Webpart SharePoint 2010

    Hi Guys,
    i have a Problem with my Custom NewForm.ASPX.  I Created a CustomForm like this Guide:
    http://www.ilikesharepoint.de/2013/11/sharepoint-create-custom-list-forms-with-visual-studio-part-2/
    Problem
    Now i set the DataFormWebpart for the Webpartzone on visible=False and add my custom DataformWebpart in this NewForm.aspx (see Code).
    After my deployment and click on "New item" i can see my custom DataForm Webpart.
    The Problems are:
    1. The Ribbon is Greyed out
    This post was not my solution. The Ribbons is not greyed out but the Ribbon has no function ("save Button" is broken)
    2. The Fields are not loaded and looks like a Displayform
    I Don't know why the Dataform does not load these fields. I can see the title but not the text Columns or lookups
    3. Save Button and the Ribbon does not work
    Only the Cancel button work on this Newform.aspx
    The Save button has no function

    Here my NewForm.aspx Link
    NewForm

Maybe you are looking for

  • Create transaction with variant not working

    Hello! Here's my issue -- I have a program that, right now, is more of a shell than anything else.  It is to access the HR Logical Database PNPCE, and to help filter the data I pull back, I created a Selection View with a couple of additional fields.

  • Multiple versions of the same JAR in sqldevelopper

    Hello, I am developing an extension for sqldeveloper using POI. The problem is that I need the latest version of POI (3.7). There is already one installed but with version 2.5.1. My question is: how can I force sqldeveloper to use version 3.7 instead

  • HP Photosmart 8250

    My HP photosmart 8250 only prints from a memory card.....one day it completely stopped printing when it was connected to my PC. I uninstalled it from my pc, went back in to re-install it but the software install wouldn't take as error msg came up and

  • BI Statistics Query - RRI Issue

    Hi Experts, I have copied a BI Statistics querys and customized it. The RRI Options available for the original query are available for the copied query as well. However, I do not want to keep all of them. When i checked  the T.code RSBBS for the copi

  • Safepoint missing after reboot

    Hello,after every reboot (balckout or similar) the MyCloud doesn't find anymore the previous Safepoint. The WD usb drive attached directly to the MyCloud is properly "seen" in the dashboard (USB icon on the top right and listed on the Shares) but in