A
Aaron
First, I am not sure if this is the correct NG. If not, please let me
know.
I have a working asp.net application which displays a datagrid. There
multiple columns in the datagrid. Each column has a corresponding
textbox located elsewhere on the form for editing. I am not editing in
the DataGrid itself. When a record is selected, the data in the columns
populates the textboxes to provide an interface for editing the record.
Here is a snippet of the code used:
Sub DataGrid_Select(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs)
FillTextBoxes(e)
End Sub
Sub FillTextBoxes(ByVal e As DataGridCommandEventArgs)
Dim Cell1 As String = e.Item.Cells(1).Text.ToString
Dim Cell2 As String = e.Item.Cells(2).Text.ToString
Dim Cell3 As String = e.Item.Cells(3).Text.ToString
If Cell1.Equals(" ") Then
txtFullname.Text = ""
Else
txtFullname.Text = Trim(Cell1)
End If
If e.Item.Cells(2).Text.Equals(" ") Then
txtCompany.Text = ""
Else
txtCompany.Text = Trim(e.Item.Cells(2).Text)
End If
If e.Item.Cells(3).Text.Equals(" ") Then
txtTitle.Text = ""
Else
txtTitle.Text = Trim(e.Item.Cells(3).Text)
End If
End sub
What I would like to accomplish is adding a "Next Record" button which
will save the current record and then move on to the next record in the
DATAGRID. Currently I have an "Update Record" button which updates the
DB and then clears all of the textboxes. I would like the "Next Record"
button to update the current record, then move to the next record in the
DATAGRID, even if that record is on the next page. I figure if I can get
that far, I might be able to add a "Previous Record" button.
1. Is the above code the best way to fill the textboxes using the
datagrid?
2. How could I implement the "Next Record" button?
I can post lots more code if needed.
Thanks,
Aaron
know.
I have a working asp.net application which displays a datagrid. There
multiple columns in the datagrid. Each column has a corresponding
textbox located elsewhere on the form for editing. I am not editing in
the DataGrid itself. When a record is selected, the data in the columns
populates the textboxes to provide an interface for editing the record.
Here is a snippet of the code used:
Sub DataGrid_Select(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs)
FillTextBoxes(e)
End Sub
Sub FillTextBoxes(ByVal e As DataGridCommandEventArgs)
Dim Cell1 As String = e.Item.Cells(1).Text.ToString
Dim Cell2 As String = e.Item.Cells(2).Text.ToString
Dim Cell3 As String = e.Item.Cells(3).Text.ToString
If Cell1.Equals(" ") Then
txtFullname.Text = ""
Else
txtFullname.Text = Trim(Cell1)
End If
If e.Item.Cells(2).Text.Equals(" ") Then
txtCompany.Text = ""
Else
txtCompany.Text = Trim(e.Item.Cells(2).Text)
End If
If e.Item.Cells(3).Text.Equals(" ") Then
txtTitle.Text = ""
Else
txtTitle.Text = Trim(e.Item.Cells(3).Text)
End If
End sub
What I would like to accomplish is adding a "Next Record" button which
will save the current record and then move on to the next record in the
DATAGRID. Currently I have an "Update Record" button which updates the
DB and then clears all of the textboxes. I would like the "Next Record"
button to update the current record, then move to the next record in the
DATAGRID, even if that record is on the next page. I figure if I can get
that far, I might be able to add a "Previous Record" button.
1. Is the above code the best way to fill the textboxes using the
datagrid?
2. How could I implement the "Next Record" button?
I can post lots more code if needed.
Thanks,
Aaron