This is my code:
protected void txtcmd_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["connect"].ConnectionString);
SqlCommand cmd = new SqlCommand();
int ID = int.Parse(Session["Id"].ToString());
string comments = ((TextBox)statusgrdview.FindControl("txtcommt")).Text;
cmd.CommandType = CommandType.Text;
cmd.CommandText = "insert into TBL_Comments(ID,comments) " + "values("+ID+",@comments);" + "select * from TBL_Comments";
cmd.Parameters.Add("@comments", SqlDbType.VarChar).Value = comments;
statusgrdview.DataSource = GetData(cmd);
statusgrdview.DataBind();
}
private object GetData(SqlCommand cmd)
{
throw new NotImplementedException();
}


Rajeesh MenothRank #118 · 18.4K reputationPosted May 4, 2015, 2:23 AM EDT
Akhil GargRank #772 · 3K reputationPosted May 4, 2015, 2:34 AM EDT
Vikram AgrawalRank #4,713 · 329 reputationPosted May 4, 2015, 2:44 AM EDT
Deepak Ratan175 reputationPosted May 4, 2015, 2:50 AM EDT
Inside the Grid View i am having the IMAGE button by clicking the button the textbox will create, In that textbox i have to type the **text** and using the button i will post the text
Like: http://aspsnippets.com/Articles/Simple-Insert-Select-Edit-Update-and-Delete-in-ASPNet-GridView-control.aspx