I'm developing a custom aspx form for a SharePoint list in Visual Studio, basically to add a new item to the list (that's a business r开发者_运维知识库equirement).
I'm wondering if there's a way to generate input controls from the list in design time just like we used to do from a database in ASP.NET.
If you're doing a straight match from the SP List to web form take a look at the SharePoint Form Generator web part
Just add the web part to the page and identify which list to build a form for.
To answer your question, yes there is a way to generate the fields. What you are looking for is the Sharepoint FormField class in the webccontrols namespace.
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.formfield.aspx
Here is an article explaining the entire field controls heirarchy for sharepoint. http://msdn.microsoft.com/en-us/library/aa543321.aspx
Generally this is used inside an ASCX control, let me know if you need any more explanation.
I discovered T4, that's exactly what I'm looking for,,, I used it to generate input controls in design time... I faced some problems accessing SharePoint from T4 templates but were resolved using The Client Object model :)
精彩评论