Hi,
I created an ASP.NET 4 columns gridview programmaticall y using VB.NET. The first two columns are bound to checkboxes and a database. When the user selects one or more checkboxes the database information populates the first two columns. I want the user to be able to enter data into the second two columns' rows. Is this possible and, if it is, how is it accomplished? Following is the code for the gridview:
Thanks - John
I created an ASP.NET 4 columns gridview programmaticall y using VB.NET. The first two columns are bound to checkboxes and a database. When the user selects one or more checkboxes the database information populates the first two columns. I want the user to be able to enter data into the second two columns' rows. Is this possible and, if it is, how is it accomplished? Following is the code for the gridview:
Code:
Private Sub BindGridView()
'Dim da As New DataLayer.SqlDataAccess
'Dim sql As String = "Select * from categories"
Dim dt As New DataTable '= da.GetDataTable(sql)
dt.Columns.Add(New DataColumn("Branch"))
dt.Columns.Add(New DataColumn("Team"))
dt.Columns.Add(New DataColumn("Reg Hrs Allocated"))
dt.Columns.Add(New DataColumn("OT Hrs Allocated"))
dt.Columns(2).ReadOnly = False
dt.Columns(3).ReadOnly = False
Dim PlaceHolder As DataRow = dt.NewRow
dt.Rows.Add(PlaceHolder)
Dim RS As SqlDataReader = ClsData.getRecordSet("Select Distinct ISNULL([Team], 'N/A') As Team, [Branch_Initials] As Branch From dbo.Employees Order By Branch_Initials", ClsData.ConnectionString)
If RS.HasRows Then
While RS.Read
System.Diagnostics.Debug.Print(RS("Branch") & ("Team"))
Dim rw As DataRow = dt.NewRow
rw.Item("Branch") = RS("Branch")
rw.Item("Team") = RS("Team")
dt.Rows.Add(rw)
End While
End If
grdAsgnTm.DataSource = dt
grdAsgnTm.DataBind()
For i As Integer = 1 To grdAsgnTm.Rows.Count - 1
grdAsgnTm.Rows.Item(i).Visible = False
Next
End Sub
Comment