A follow up on a previous post of mine where I'm loading sql tables into gridview dynamically.
Works fine until I get to updating tables that have checkboxes in a few columns.
I get System.InvalidCastException: 'Unable to cast object of type 'System.Web.UI.WebControls.CheckBox' to type 'System.Web.UI.WebControls.TextBox" on the first line below when the first checkbox is encountered.
If I change string to checkbox and textox).text to checkbox), then I'm able to get by the first line below.
I'm unable to come with an IF STATEMENT to check string vs. checkbox.
Dim columnValue As String = CType(row.Cells(i).Controls(0), TextBox).Text
sql += String.Format("{0} = '{1}', ", columnName, columnValue)
TString.Format(" WHERE {0} = '{1}'", CType(GV1.HeaderRow.Cells(1).Controls(0), LinkButton).Text, CType(row.Cells(1).Controls(0), TextBox).Text)
Getting past the above leads to a second error on cmd.ExecuteNonQuery, "conversion failed when converting varchar value to checkbox to datatype bit".
Thoughts?
Thanks in advance.