I have developed a UserControl in Visual Studio 2010 and deployed into "\ControlTemplates\MyCustomUserControls\" folders. The control has only two textboxes along with the label and on page load initializing both textboxes with some values.

Then I've created a Custom List with two fields and using SPD I've copied the NewForm.aspx to NewProductForm.aspx ..What I want is to erase the html from NewProductForm.aspx and insert my own UserControl inside..and when user click on Add Item it would display my custom user control based form.

Just dont know what to remove from NewProductForm.aspx and how to embed control in it.


2 ways I see:

  1. Create a web part and on load show the user control that is built
  2. Add the user control tag. Register the control before it is used.

In both scenarios do not delete the default web part from the newform.aspx page Just close the web part and add you custom web part or user control.

Hope this helps you!!!

| improve this answer | |

If you use VS2010 to create list, you can use this approach or you can use SharePoint designer for the list that is created before/ I hope this post will be helpful. If i'm not wrong you can drag and drop your control from the designer palette, see this post how to add your control.

| improve this answer | |
  • Thanks for the reply. I've added the control tag like this on top. <%@ Register TagPrefix="NewProduct" TagName="NewProd" Src="~/_controltemplates/ProductCustomUserControls/NewProduct.ascx" %> I know now how to embed control like this <NewProduct:NewProd id="ProdUserControl" runat="server" /> But I can see the title and list fields also..if i remove something it removes the form also. Which content template i should remove and in which content template i would add the control so only my control is visible. thanks – user342944 Aug 31 '12 at 7:21
  • ok now my user control is appearing on top of Title field which I dont want ..how to remove the default list fields appears on NewForm.aspx? which controls I need to remove from NewForm.aspx – user342944 Aug 31 '12 at 7:50
  • How did you create this page and add reference to this page in list? Depends on it there are several solutions. – Alexander Aug 31 '12 at 10:17

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.