From: JohnE on 1 Jun 2010 08:50 I have a formview with a gridview inside of it. In the C# code behind the page (listed below) the line of gvwEditChildren.Databind, I get the following error message; The name 'gvwEditChildren' does not exist in the current context. The gridview exists. If I do not use the code behind, it runs fine except the linkbutton for insert doesnot work. The gridview is populated by a sqldatasource. I tried the 'No Build' for start options but it still errors out. Intellisent also is not showing it. protected void gvwEditChildren_RowCommand(object sender, GridViewCommandEventArgs e) { SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ProteusConnectionString"].ConnectionString); try { if (e.CommandName.Equals("Insert")) { LinkButton lbtnInsert = e.CommandSource as LinkButton; GridViewRow row = lbtnInsert.NamingContainer as GridViewRow; if (row == null) { return; } DropDownList ddlIsChildOfEdit = row.FindControl("ddlIsChildOfEdit") as DropDownList; SqlCommand cmd = new SqlCommand("INSERT INTO [tblChangeRequest] ([IsChildOf] VALUES (@ChangeRequestID)", conn); cmd.Parameters.AddWithValue("ChangeRequestID", ddlIsChildOfEdit.SelectedValue); conn.Open(); if (cmd.ExecuteNonQuery() == 1) { gvwEditChildren.DataBind(); } } } catch (Exception ex) { } finally { conn.Close(); } Has anyone come across this error message before? Thanks. John
|
Pages: 1 Prev: FileUpload in UpdatePanel Next: Can't adjust the iFrame height to fit the contents. |