2
Answers

Hw cn insert commt,if txtbx btn r in datalist

Gaurav Raj

Gaurav Raj

7y
184
1
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)