ASP.NET Membership offers a prefabricated registry of users and roles. There are situations in which the membership User ID needs to be referenced in the database. You can reference a User ID with the User Id Lookup items style.
Create an Owner field in the Orders table.
Start SQL Server Management Studio. In the Object Explorer, right-click on Databases / Northwind / Tables / dbo.Orders node, and select Design option.
Add a column with the following properties:
Save the table design modifications.
Note that the data type of the field may be configured as uniqueidentifier if you are working with SQL Server. If your database engine is MySQL, then int type can be used instead.
Start Code On Time web application generator. Click on the project name, and refresh the Orders data controller.
Press Generate to regenerate the web application. When it opens in a browser window, navigate to Orders page and edit a record. The OwnerId field is just a simple text box. It needs to be converted into a User Id Lookup.
Start the Project Designer. Switch to the Controllers tab, and double-click on Orders/ Fields / OwnerId node.
Give this field the following properties:
|User ID Lookup
Press OK to save the field. On the toolbar, press Browse, and wait for the application to load.
Navigate to the Orders page, and edit a record. The Owner field will now be a lookup.
Click on the lookup link, and it will show a list of users.
When you select a user, the User Id will be inserted into the field.