Wednesday, June 2, 2010

How to use the SharePoint Web Controls

Nice article in case you want to build aspx page inside sharepoint. The idea to build new\edit\view page from scratch comes to my mind when a validation became critical.

The standard field validation in sharepoint can't do much. Because of that, the real aspx power gets needed.

Quick start "how to implement a validation in sharepoint new/edit/view pages":
1. Create aspx page (don't forget to put a reference to master page).
2. Find a web contol analog for a sharepoint field (ex. : Rich Text in sharepoin is RichTextField in aspx page)
3. Add the attribute FieldName (static name of field in the content type) ControlMode (New/Edit/View) to a control
4. Add ASPX validation
5. Change schema.xml to use this aspx for content type

Here is a Microsoft share on it 

Here is a list of all sharepoin web controls

 And just in case you want to figure out how the listfieliterator control works (the main reason why we can enjoy generic forms)

Highly recomend use this control (InputFormSection) instead of rows in the table where you want to place controls