A
Aaron
I am currently filling textboxes with the data from a datagrid with the
following code:
Sub Fillnextrecord(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
Dim Cell4 As String = e.Item.Cells(4).Text.ToString
Dim Cell5 As String = e.Item.Cells(5).Text.ToString
Dim Cell6 As String = e.Item.Cells(6).Text.ToString
Dim Cell7 As String = e.Item.Cells(7).Text.ToString
Dim Cell8 As String = e.Item.Cells(8).Text.ToString
Dim Cell9 As String = e.Item.Cells(9).Text.ToString
Dim Cell10 As String = e.Item.Cells(10).Text.ToString
Dim Cell11 As String = e.Item.Cells(11).Text.ToString
Dim Cell12 As String = e.Item.Cells(12).Text.ToString
Dim Cell13 As String = e.Item.Cells(13).Text.ToString
Dim Cell14 As String = e.Item.Cells(14).Text.ToString
Dim Cell15 As String = e.Item.Cells(15).Text.ToString
Dim Cell16 As String = e.Item.Cells(16).Text.ToString
Dim Cell17 As String = e.Item.Cells(17).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
If Cell4.Equals(" ") Then
txtBPhone.Text = ""
Else
txtBPhone.Text = Trim(Cell4)
End If
If e.Item.Cells(5).Text.Equals(" ") Then
txtWorkExt.Text = ""
Else
txtWorkExt.Text = Trim(e.Item.Cells(5).Text)
End If
If e.Item.Cells(6).Text.Equals(" ") Then
txtClientCell.Text = ""
Else
txtClientCell.Text = Trim(e.Item.Cells(6).Text)
End If
If e.Item.Cells(7).Text.Equals(" ") Then
txtNotes.Text = ""
Else
txtNotes.Text = Trim(e.Item.Cells(7).Text)
End If
If e.Item.Cells(9).Text.Equals(" ") Then
txtConfNotes.Text = ""
Else
txtConfNotes.Text = Trim(e.Item.Cells(9).Text)
End If
If e.Item.Cells(10).Text.Equals(" ") Then
txtActDate.Text = ""
Else
txtActDate.Text = Trim(e.Item.Cells(10).Text)
End If
If e.Item.Cells(11).Text.Equals(" ") Then 'If the FU date in
the grid is blank, then run function to count three businessdays
txtFollowUpDate.ForeColor = System.Drawing.Color.Black()
txtFollowUpDate.Text = FormatDateTime
(WebBizDev.Utilities.BusinessDateAdd(FormatDateTime(Now,
DateFormat.ShortDate), 3), DateFormat.ShortDate)
Else
Dim FUDate As Date = e.Item.Cells(11).Text
If FUDate < FormatDateTime(Now, DateFormat.ShortDate) Then
'ASPNET_MsgBox("The Follow Up Date has expired.")
txtFollowUpDate.ForeColor = System.Drawing.Color.Red()
txtFollowUpDate.Text = Trim(FUDate)
Else
txtFollowUpDate.ForeColor = System.Drawing.Color.Black()
txtFollowUpDate.Text = Trim(e.Item.Cells(11).Text)
End If
End If
If e.Item.Cells(14).Text.Equals(" ") Then
Label18.Text = ""
Else
Label18.Text = Trim(e.Item.Cells(14).Text)
End If
If e.Item.Cells(15).Text.Equals(" ") Then
Label19.Text = ""
Else
Label19.Text = Trim(e.Item.Cells(15).Text)
End If
If e.Item.Cells(17).Text.Equals(" ") Then
txtEmail.Text = ""
Else
txtEmail.Text = Trim(e.Item.Cells(17).Text)
End If
If e.Item.Cells(18).Text.Equals(" ") Then
txtBMail.Text = ""
Else
txtBMail.Text = Trim(e.Item.Cells(18).Text)
End If
If e.Item.Cells(19).Text.Equals(" ") Then
txtHomePhone.Text = ""
Else
txtHomePhone.Text = Trim(e.Item.Cells(19).Text)
End If
This is used to fill textboxes for editing the data. Once the data has
been modified, the user hits the "Update Record" button and the changes
are commited to the database.
I need to be able to move to the next record, or row in the datagrid. I
know the e is the datagrideventarg, and that is about it. I have tried e
+1 but that doesn't work.
Could anyone show me how to move to the next record? I am sure this is
not the best way to fill those textboxes, but it is the only way I found
to do it. Perhaps if there is a better approach, you could show me that
and how I would be able to move to the next row or record.
Thanks,
Aaron
following code:
Sub Fillnextrecord(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
Dim Cell4 As String = e.Item.Cells(4).Text.ToString
Dim Cell5 As String = e.Item.Cells(5).Text.ToString
Dim Cell6 As String = e.Item.Cells(6).Text.ToString
Dim Cell7 As String = e.Item.Cells(7).Text.ToString
Dim Cell8 As String = e.Item.Cells(8).Text.ToString
Dim Cell9 As String = e.Item.Cells(9).Text.ToString
Dim Cell10 As String = e.Item.Cells(10).Text.ToString
Dim Cell11 As String = e.Item.Cells(11).Text.ToString
Dim Cell12 As String = e.Item.Cells(12).Text.ToString
Dim Cell13 As String = e.Item.Cells(13).Text.ToString
Dim Cell14 As String = e.Item.Cells(14).Text.ToString
Dim Cell15 As String = e.Item.Cells(15).Text.ToString
Dim Cell16 As String = e.Item.Cells(16).Text.ToString
Dim Cell17 As String = e.Item.Cells(17).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
If Cell4.Equals(" ") Then
txtBPhone.Text = ""
Else
txtBPhone.Text = Trim(Cell4)
End If
If e.Item.Cells(5).Text.Equals(" ") Then
txtWorkExt.Text = ""
Else
txtWorkExt.Text = Trim(e.Item.Cells(5).Text)
End If
If e.Item.Cells(6).Text.Equals(" ") Then
txtClientCell.Text = ""
Else
txtClientCell.Text = Trim(e.Item.Cells(6).Text)
End If
If e.Item.Cells(7).Text.Equals(" ") Then
txtNotes.Text = ""
Else
txtNotes.Text = Trim(e.Item.Cells(7).Text)
End If
If e.Item.Cells(9).Text.Equals(" ") Then
txtConfNotes.Text = ""
Else
txtConfNotes.Text = Trim(e.Item.Cells(9).Text)
End If
If e.Item.Cells(10).Text.Equals(" ") Then
txtActDate.Text = ""
Else
txtActDate.Text = Trim(e.Item.Cells(10).Text)
End If
If e.Item.Cells(11).Text.Equals(" ") Then 'If the FU date in
the grid is blank, then run function to count three businessdays
txtFollowUpDate.ForeColor = System.Drawing.Color.Black()
txtFollowUpDate.Text = FormatDateTime
(WebBizDev.Utilities.BusinessDateAdd(FormatDateTime(Now,
DateFormat.ShortDate), 3), DateFormat.ShortDate)
Else
Dim FUDate As Date = e.Item.Cells(11).Text
If FUDate < FormatDateTime(Now, DateFormat.ShortDate) Then
'ASPNET_MsgBox("The Follow Up Date has expired.")
txtFollowUpDate.ForeColor = System.Drawing.Color.Red()
txtFollowUpDate.Text = Trim(FUDate)
Else
txtFollowUpDate.ForeColor = System.Drawing.Color.Black()
txtFollowUpDate.Text = Trim(e.Item.Cells(11).Text)
End If
End If
If e.Item.Cells(14).Text.Equals(" ") Then
Label18.Text = ""
Else
Label18.Text = Trim(e.Item.Cells(14).Text)
End If
If e.Item.Cells(15).Text.Equals(" ") Then
Label19.Text = ""
Else
Label19.Text = Trim(e.Item.Cells(15).Text)
End If
If e.Item.Cells(17).Text.Equals(" ") Then
txtEmail.Text = ""
Else
txtEmail.Text = Trim(e.Item.Cells(17).Text)
End If
If e.Item.Cells(18).Text.Equals(" ") Then
txtBMail.Text = ""
Else
txtBMail.Text = Trim(e.Item.Cells(18).Text)
End If
If e.Item.Cells(19).Text.Equals(" ") Then
txtHomePhone.Text = ""
Else
txtHomePhone.Text = Trim(e.Item.Cells(19).Text)
End If
This is used to fill textboxes for editing the data. Once the data has
been modified, the user hits the "Update Record" button and the changes
are commited to the database.
I need to be able to move to the next record, or row in the datagrid. I
know the e is the datagrideventarg, and that is about it. I have tried e
+1 but that doesn't work.
Could anyone show me how to move to the next record? I am sure this is
not the best way to fill those textboxes, but it is the only way I found
to do it. Perhaps if there is a better approach, you could show me that
and how I would be able to move to the next row or record.
Thanks,
Aaron