Hi Everyone,
In my grid there's 3 columns, "Client Id", "Client first name", "Client last name". The client first and last name columns are read only. When the user enters the Client Id the CellValueChange event is fired, which gets the first and last name for the Client Id from the database, then puts the first and last name values in their respective columns.
Here's the code:
This works great when editing existing records, but not at all for adding new records. During add new, the event does fire, and does get the correct first/last name values, and the code to put the first/last name value does fire and seems to work, but when looking at the cell value, nothing actually gets there.
If the new row is committed (by <enter> or clicking out of the row), then going back and setting the client id, the code works. But of course, that doesn't fulfill the requirements. The code needs to work by merely <tabbing> out of the Client Id column on a new row.
Thanks in advance for any and all suggestions and advice.
In my grid there's 3 columns, "Client Id", "Client first name", "Client last name". The client first and last name columns are read only. When the user enters the Client Id the CellValueChange event is fired, which gets the first and last name for the Client Id from the database, then puts the first and last name values in their respective columns.
Here's the code:
Private Sub gridClients_CellValueChanged(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.GridViewCellEventArgs)
Dim column As GridViewDataColumn = TryCast(e.Column, GridViewDataColumn)
If column IsNot Nothing AndAlso column.FieldName = "ClientId" Then
e.Row.Cells(
"vcFirstName").Value = GetClientFirstName(e.Value)
e.Row.Cells(
"vcLastName").Value = GetClientLastName(e.Value)
End If
End Sub
This works great when editing existing records, but not at all for adding new records. During add new, the event does fire, and does get the correct first/last name values, and the code to put the first/last name value does fire and seems to work, but when looking at the cell value, nothing actually gets there.
If the new row is committed (by <enter> or clicking out of the row), then going back and setting the client id, the code works. But of course, that doesn't fulfill the requirements. The code needs to work by merely <tabbing> out of the Client Id column on a new row.
Thanks in advance for any and all suggestions and advice.