Gaurav Raj

Gaurav Raj

  • NA
  • 475
  • 88.5k

Hw cn insert commt,if txtbx btn r in datalist

Mar 20 2017 3:30 AM
protected void Button2_Click(object sender, EventArgs e) { string Id = ((Button)sender).CommandArgument; com.User_Id = Convert.ToInt32(Session["Id"]); com.Blog_Id = Convert.ToInt32(Id); foreach (DataListItem dli in DataList1.Items) { TextBox text = (TextBox)dli.FindControl("CommentText"); com.Comment = text.Text; } cs.da.CommentTables.InsertOnSubmit(com); cs.da.SubmitChanges(); Response.Redirect(Request.Url.AbsoluteUri);//prevent to reinsert data after refresh data UpdatePanel1.Update(); }

Answers (2)