Hi! Thanks for the help!! I tried your way, however it does not work. I've been stepping the program through and the problem lies with the fact that it is somehow ignoring boxes that are checked. So it keeps looping to If cb = true then and then skipping the entire code within and just stepping over to End If This is really confusing =/
Kenshino
Posts
-
Help me with weird datagrid checkbox problem -
Help me with weird datagrid checkbox problemI'm trying this out and I have a strong feeling that it will help with my problem. However, I am stuck at trying to dim a new DataGridTableStyle. Is this not available in The .Net 1.1 framework or something? Visual Studio 2003 says that Type DataGridTableStyle is not defined. I tried reading http://msdn.microsoft.com/msdnmag/issues/03/08/DataGrids/default.aspx#S6 and it talks about DataGridTableStyle, yet visual studio does not seem to recognise this. What should I do? And a million thanks for your many replies!
-
dataset setupHi, this is an excerpt from one of my recent projects
Dim connection As New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString")) Dim command As New SqlCommand("Select * from course inner join Faculty on course.CMgr = faculty.staffID", connection) Dim dataAdapter As New SqlDataAdapter(command) Dim result As New DataSet connection.Open() dataAdapter.Fill(result, "Course") connection.Close() addCourseGrid.DataSource = result addCourseGrid.DataBind()
I hope it helps! -
Help me with weird datagrid checkbox problemThanks Kevin. I think understand the logic behind your explanation, however I fail to find anything that relates DataGridBoolColumn in Visual Studio 2003. Is there something that I'm missing? What I'm trying to do is to allow the administrator to tick the courses that he wants to delete and then when he clicks the confirm button, the code scrolls through, if it's ticked, it sends the SQL command and deletes it. I'm sorry for troubling you =/
-
Help me with weird datagrid checkbox problemHi! Thanks for the help. But I'm really not sure what you mean. Could you elaborate? Thanks!
-
Help me with weird datagrid checkbox problemI'm not sure if this is the correct area, forgive me if it is not! I have this datagrid that is called deleteCourseGrid and it has a template column. I put a checkbox inside and its ID is deleteCheck. I also have a confirm button that runs the code below. The problem is, somehow, it does not detect that a box is checked. I tried checking each individual rows and cb.checked is always false. Am I doing something wrong? Thanks for help in advance!
Dim connection As New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString")) Dim command As New SqlCommand("delete from course where courseID = @courseID", connection) Dim i As Integer = 0 Dim cb As CheckBox Dim courseID As String cb = deleteCourseGrid.Items(i).FindControl("deleteCheck") For i = 0 To deleteCourseGrid.Items.Count - 1 If cb.Checked = True Then courseID = deleteCourseGrid.Items(i).Cells(0).Text command.Parameters.Add("@courseID", courseID) connection.Open() command.ExecuteNonQuery() connection.Close() End If Next Response.Redirect("updated.aspx")