Posts

Validating long form using jQuery

Programmer's are always wondering when it comes with validating long form with hundreds of controls. Most of the time programmers write code for saving and updating form values but validating is troublesome job for them and they often miss it or ignore is due to length of long form and too many controls. Checking validation manually using server side code is too troublesome. So, today I'm going to show you a simple jQuery for validating form. Since, it's a dynamic jQuery so you need not to worry about length of form and no. of controls on any form. Step 1: Place the following style on your page or stylesheet. span.required { color : Red ; font-size : 10px ; } span.number { color : Red ; font-size : 10px ; } span.date { color : Red ; font-size : 10px ; } span.emailid { color : Red ; font-size : 10px ; } Next step, a...

SharePoint WebControls

In this post I’m going to tell you how to use SharePoint’s web controls in our custom code. It is very easy to use and it gives look and feel of SharePoint’s default forms. First we have to add the reference for Microsoft.SharePoint assembly and add using Microsoft.SharePoint.WebControls Assembly: Microsoft.SharePoint (in microsoft.sharepoint.dll) Namespace: Microsoft.SharePoint.WebControls SPWeb web = SPContext.Current.Web ; SPList list = web.Lists[ "ListName" ]; // Display Lookup field with Multiple selection enabled MultipleLookupField mlkpfield = new MultipleLookupField (); mlkpfield.ListId = list.ID; mlkpfield.FieldName = "MultiLookup" ; mlkpfield.ControlMode = SPControlMode .New; this .Controls.Add(mlkpfield); // Display List View Toolbar ViewToolBar toolbar = new ViewToolBar (); SPContext context = SPContext .GetContext( this .Context, list.DefaultView.ID, list.ID, SPContext .Current.Web); toolbar.RenderContext = con...