This is for reloading the current page. I used it for after comment the page.

Page.Response.Redirect(Page.Request.Url.ToString(), true);

        protected void btn_insertComment_Click(object sender, EventArgs e)
        {
            SqlCommand cmd = new SqlCommand("insert into Comment(commentNameSurname,commentEmail,commentContent,commentPicture,articleId) Values('" + txt_NameSurname.Text + "','" + txt_Email.Text + "', '" + txt_Comment.Text + "','/theme/comment.png', '" + articleId + "')", connect.connect());
            cmd.ExecuteNonQuery();
            SqlCommand cmdInsert = new SqlCommand("Update Article Set articleNumOfComment = articleNumOfComment+1 where makaleId='" + articleId + "'", connect.connect());
            cmdInsert.ExecuteNonQuery();

            lbl_info.Text = "It has done";
            txt_NameSurname.Text = "";
            txt_Email.Text = "";
            txt_Comment.Text = "";

            Page.Response.Redirect(Page.Request.Url.ToString(), true);  //sayfa yenilensin diye      

        }

Recommended Answers

All 3 Replies

No, I'm beginner and wanted to share some thing. Just wondering :)

Thanks for sharing the information though I expected a question.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.