How to create items programmatically in Sitecore
<p>In the content tree, the structure is as follows</p>

<pre><code>Home
 -England
 -France
 -Germany
</code></pre>

<p>There is a sublayout (CommentsForm.ascx), which is used in all the 3 pages. When user browses 'France' and submits a comment, the 'Comment' item should get saved under 'France' and so on..</p>

<p>In this scenario, the Parent item (under which the new item has to be created), is dynamic. So, how to get the parent item in such case. Is this correct?</p>

<pre><code>protected void btnSubmit_Click(object sender, EventArgs e)
{
 Sitecore.Data.Database masterDB =   Sitecore.Configuration.Factory.GetDatabase("master");

 Item parentItem = Sitecore.Context.Item;

 string name = "Comment_" + Sitecore.DateUtil.IsoNow;
 TemplateItem template = masterDb.GetTemplate("/sitecore/templates/userdefined/Comment");     

 using (new SecurityDisabler())
 {
   //how to go about here??
   //newItem["Author"] = txtAuthor.text;
   //newItem["CommentText"] = txtComments.Text;
   //parentItem.Add("name", template);
 }
}
</code></pre>