LonnieJohnson
Programmer
I have a grid view on an ASP.net page. I am using it to display info in a multi-column list format.
A user puts data into two text boxes and I want to add the info to the grid view. If they do this two times I should see two rows. My problems...
1. How do I get more than two rows?
2. How do I delete a row? (I had the delete button and it gave an error message when I clicked it.)
Here is my code that I have in a command button...
ProDev, MS Access Applications
Visit me at ==>
May God bless you beyond your imagination!!!
A user puts data into two text boxes and I want to add the info to the grid view. If they do this two times I should see two rows. My problems...
1. How do I get more than two rows?
2. How do I delete a row? (I had the delete button and it gave an error message when I clicked it.)
Here is my code that I have in a command button...
Code:
Dim myDataTable As DataTable = New DataTable("AdditionalCodes")
myDataColumn = New DataColumn
myDataColumn.DataType = System.Type.GetType("System.String")
myDataColumn.ColumnName = "hours"
myDataColumn.Caption = "Hours"
myDataColumn.Unique = False
myDataTable.Columns.Add(myDataColumn)
myDataColumn = New DataColumn
myDataColumn.DataType = System.Type.GetType("System.String")
myDataColumn.ColumnName = "proccode"
myDataColumn.Caption = "Procedure Code"
myDataColumn.Unique = False
myDataTable.Columns.Add(myDataColumn)
myDataRow = myDataTable.NewRow()
myDataRow("hours") = Me.cbHoursAdd.SelectedValue
myDataRow("proccode") = Me.cbProcCodeAdd.SelectedValue
myDataTable.Rows.Add(myDataRow)
Me.gvAdditionalCodes.DataSource = myDataTable
Me.gvAdditionalCodes.DataBind()
ProDev, MS Access Applications
Visit me at ==>
May God bless you beyond your imagination!!!