PDA

Click to See Complete Forum and Search --> : displaying a column from lookup table upon entering values in a datagrid column


Marivic
Nov 13th, 2002, 02:08 AM
Hi all,

I have a datagrid with 3 columns (userid, username, userpass). Is it possible that upon entering userid (the user will tab to the next column) , I wanted to lookup to a particular table to validate if the userid exists and if exists, display the value of username.

Any help would be greatly appreciated.

Marivic

iulianionescu
Nov 13th, 2002, 09:00 AM
I think one way would be like this:

derive a custom data grid column: and override the edit event:

Public Class CustomDataGridColumn
inherits DataGridTextBoxColumn

Public sub New()
MyBase.New()
End Sub

Public Overloads Overrides Sub Edit(.... the longest version)

MyBase.Edit
Dim value as String = CType(GetColumnValueAtRow(source, rowNum), String)

if Not PerformCheck(value) then
MsgBox("Invalid ID !")
else
...
end if
end sub

end Class

Then when you add your column styles use your custom class.