Click here to Skip to main content
15,889,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi my friends, I'm a newbie in sp2010.

My question sounds like:

How can I create custom New, Edit and Display forms and use it instead of standart? :)

My solution:
SPWeb web = SPContext.Current.Web;
web.AllowUnsafeUpdates = true;
SPList list = web.Lists["My List"];
SPContentType ct = list.ContentTypes["Item"];
ct.EditFormUrl = "_layouts/editform.aspx";
ct.NewFormUrl = "_layouts/newform.aspx";
ct.DisplayFormUrl = "_layouts/dispform.aspx";
ct.Update();
list.Update();


But what about CAML? Example?

Thanks.

One day after...
I found solution :) In the list definition add:
XML
<XmlDocuments>
     <XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
        <FormUrls xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
            <New>_layouts/NewQuote.aspx</New>
            <Edit>_layouts/EditQuote.aspx</Edit>
            <Display>_layouts/ViewQuote.aspx</Display>
        </FormUrls>
    </XmlDocument>
</XmlDocuments>

Thanks...
Posted
Updated 20-Dec-10 21:31pm
v3
Comments
JF2015 20-Dec-10 5:58am    
Edited to correct code formatting.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900