1

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 Answers 2

1

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!!!

0

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.

3
  • 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 Commented Aug 31, 2012 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 Commented Aug 31, 2012 at 7:50
  • How did you create this page and add reference to this page in list? Depends on it there are several solutions. Commented Aug 31, 2012 at 10:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.