I know it's simple question, but it's new for me
I created a list in visual studio , I deployed the solution and worked fine. But I would like to add items in list as default from Visual studio, is it possible?
It is possible.
When you create the list instance in Visual Studio, the created xml file contains the
<ListInstance> element where you can add child
<Data> element. That's where you can add the items to the list.
Here's the example xml definition which adds one item to the list:
<ListInstance Title="MyList" Description="MyList Description" FeatureId="xxx" Id="xxx" Url="Lists/MyList" OnQuickLaunch="TRUE" QuickLaunchUrl="Lists/MyList/AllItems.aspx" RootWebOnly="FALSE" TemplateType="xxx" > <Data> <Rows> <Row> <Field Name="Field1Name">test</Field> <Field Name="Field2Name">1</Field> <Field Name="Field3Name"><![CDATA[test]]></Field> </Row> </Rows> </Data> </ListInstance>
This msdn article contains the definition of the List Instance element and all the children that it can contain.