Click here to Skip to main content
11,931,104 members (67,982 online)
Click here to Skip to main content
Add your own
alternative version


65 bookmarked

ASP.NET using GridView Control as Lookup

, 22 Nov 2008 CPOL
Rate this:
Please Sign up or sign in to vote.
ASP.NET using GridView control as lookup
Screenshot - Lookup.jpg


This simplifies the way to enter lookup values in a textbox.
I have used GridView to return lookup values for FormView control.

You can use the lookup to return a value to any ASP.NET textbox control.

I have used two lookup pages, lookupSupplier.aspx and lookupCategory.aspx. These two lookup pages work for main page default.aspx page which has FormView control that is used for inserting and editing the Products table.


You must know how the GridView control works.

Using the Code

The following is an example of creating a template column for GridView control.

You need to add an ASP.NET hyperlink control for a template column. This hyperlink will be used to return the value(text) in column one (column index 0) of the GridView control.

<asp:HyperLink ID="hlReturnLookupValue" runat="server">Select</asp:HyperLink>

Points of Interest

Try to use caching for lookup pages so that lookup pages get opened quickly and work fast. However, this is not essential.


I will update this page based on your feedback.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Amit K Bhagat
Web Developer
India India

You may also be interested in...

Comments and Discussions

GeneralMy vote of 4 Pin
Utuba3-Jun-13 23:07
memberUtuba3-Jun-13 23:07 
The method is sound and worked very well for me. I have used it for VS 2008 and now VS 2010 Web sites.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.151126.1 | Last Updated 23 Nov 2008
Article Copyright 2007 by Amit K Bhagat
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid