0
votes

I am a newbie to SharePoint 2010 development, even though am a .net developer for past 3 years. I have setup development env with windows 7(64-bit), sharepoint foundation 2010, visual studio 2010, and sql server 2001 R2 in a virtual machine. As a beginning, I created a new web application in SharePoint 2010 and also created new site collection. Then I created a custom list for student details. Now I need to create a simple student registration page which validate all the user entries for example email id, phone number etc using regular expression and few fields using required field validator. I need to how can I use Visual Studio 2010 for this purpose. Please consider this as an entry level question in SharePoint 2010 development. Hope this question fits right in this forum.

1
you could develop your application in asp.net and set it up properly in iss then just extend the application to sharepoint. I am also new to sharepoint development but coming from a few years of asp.net as well i found this the easiest. for validation since the application will be extended - do it the same way you would for an application not using sharepoint (javascript/whatever you prefer for field validators)njj56

1 Answers

1
votes

Start the Visual studio File Menu-> New -> Project -> Select SharePoint From installed Template -> Empty SharePoint Project Give proper name and save it

then it ask for SharePoint URL

enter SharePoint URL and validate it then press Finish button

Now your solution is ready to use

in solution explorer select project right click on it Add new Item -> Visual web part you have to write your code in User control on this web part some code snippet is as follow:

using (SPSite site = new SPSite(SPContext.Current.Site.Url))
{
    using (SPWeb web = site.OpenWeb())
    {
        SPList StudentInfoList = web.Lists["Student Information"];
        SPListItemCollection listItems = StudentInfoList.GetItems();
        SPListItem item = listItems.Add();
        item["RollNumber"] = Convert.ToInt32(TextBox1.Text);;
        item["StudentName"] = TextBox2.Text
        item["PhoneNumber"] = TextBox3.Text;
        item["EmailID"] = TextBox4.Text;
        item.Update();
        StudentInfoList.Update();
    }
}

Welcome to SharePoint :-)