string temp2 = grdView.Rows[i].Cells[3].Text;
<itemtemplate> <asp:Label ID="lblComments" runat="server" Text='<%# Bind("Comments") %>'> <asp:TextBox ID="txtComments" runat="server"> </itemtemplate>
protected void btnUpdae_Click(object sender, EventArgs e) { string connection = System.Configuration.ConfigurationManager.ConnectionStrings["QuestionnaireConnection"].ConnectionString; using (SqlConnection con = new SqlConnection(connection)) { con.Open(); if (grdView.Rows.Count > 0) //[here the row count is zero { foreach (GridViewRow row in grdView.Rows) //[if I have break point here I am not getting into the loop] { for (int i = 0; i < grdView.Rows.Count; i++) { Question qs = new Question(); string name = Request.QueryString["UserName"]; string temp1 = grdView.Rows[i].Cells[0].Text; string temp2 = grdView.Rows[i].Cells[3].Text; SqlDataAdapter da; da = new SqlDataAdapter("UPDATE Questionnaire_UserAnswers SET Comments='" + temp2 + "' WHERE Question_ID=" + temp1 + "", con); DataSet ds = new DataSet(); da.Fill(ds); grdView.DataSource = ds; } grdView.EditIndex = -1; ShowGridBindData(); lblmessage.Visible = true; lblmessage.Text = "Record Updated Successfully"; } }
string textBoxText = _ ((TextBox)row.FindControl("TextBox1")).Text;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)