protected void btnPostComment_Click(object sender, EventArgs e)
        {
            var divtimespan = Master.FindControl("divtimespan") as HtmlGenericControl;
            Stopwatch sw = new Stopwatch();
            sw.Start();
            string photoIdstring = Request["photoId"];
            int photoId = -1;
            if (!int.TryParse(photoIdstring, out photoId)) return;

            using (GalleryEntities ge = new GalleryEntities())
            {
                Comments c = new Comments();
                c.photoId = photoId;
                c.name = tbName.Text;
                c.text = tbComment.Text;
                ge.AddToComments(c);
                ge.SaveChanges();
            }

            ListView1.DataBind();

            sw.Stop();
            if (divtimespan != null)
                divtimespan.InnerText = string.Format("Elapsed time: {0}", sw.Elapsed);
        }
 /// <summary>
 /// Create a new Comments object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 /// <param name="photoId">Initial value of the photoId property.</param>
 /// <param name="name">Initial value of the name property.</param>
 /// <param name="text">Initial value of the text property.</param>
 public static Comments CreateComments(global::System.Int32 id, global::System.Int32 photoId, global::System.String name, global::System.String text)
 {
     Comments comments = new Comments();
     comments.id = id;
     comments.photoId = photoId;
     comments.name = name;
     comments.text = text;
     return comments;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Comments EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToComments(Comments comments)
 {
     base.AddObject("Comments", comments);
 }