Click here to Skip to main content
5,785,816 members and growing! (18,692 online)
Email Password   helpLost your password?
Web Development » ASP.NET » General     Intermediate License: The Code Project Open License (CPOL)

ASP.NET using GridView Control as Lookup

By Amit K Bhagat

ASP.NET using GridView control as lookup
VB, Windows, .NET, ASP.NET, WebForms, SQL 2000, SQL 2005, VS2005, SQL Server, Visual Studio, DBA, Dev

Posted: 24 Mar 2007
Updated: 22 Nov 2008
Views: 69,291
Bookmarked: 41 times
Announcements
Loading...



Search    
Advanced Search
Sitemap
7 votes for this Article.
Popularity: 2.43 Rating: 2.88 out of 5
1 vote, 14.3%
1
2 votes, 28.6%
2
2 votes, 28.6%
3
0 votes, 0.0%
4
2 votes, 28.6%
5
Screenshot - Lookup.jpg

Introduction

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.

Background

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:TemplateField>
<ItemTemplate>
<asp:HyperLink ID="hlReturnLookupValue" runat="server">Select</asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>

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.

History

I will update this page based on your feedback.

License

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


Developer
Occupation: Web Developer
Location: India India

Other popular ASP.NET articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 24 of 24 (Total in Forum: 24) (Refresh)FirstPrevNext
GeneralWhy not a listboxmemberDonsw4:12 8 Dec '08  
GeneralMy vote of 2memberRuchit Surati23:37 24 Nov '08  
GeneralHow can I download the video version of this article?membersunisagar11:50 20 Nov '08  
GeneralRe: How can I download the video version of this article?memberAmit K Bhagat18:21 20 Nov '08  
GeneralRe: How can I download the video version of this article?memberAmit K Bhagat21:07 21 Nov '08  
GeneralRe: How can I download the video version of this article?memberAmit K Bhagat20:17 22 Nov '08  
GeneralGood one.memberMember 382627512:30 30 Oct '08  
GeneralRe: Good one.memberAmit K Bhagat18:09 30 Oct '08  
QuestionVideo username and passwordmemberArvin Meralpis17:31 20 Jun '07  
AnswerRe: Video username and passwordmemberAmit K Bhagat23:51 20 Jun '07  
GeneralRe: Video username and passwordmemberArvin Meralpis9:12 25 Jun '07  
GeneralhelpmemberChard_olea1:45 1 Apr '07  
GeneralRe: helpmemberAmit K Bhagat1:53 1 Apr '07  
GeneralRe: helpmemberChard_olea2:01 1 Apr '07  
GeneralvideomemberChard_olea0:48 1 Apr '07  
GeneralRe: videomemberAmit K Bhagat0:50 1 Apr '07  
GeneralRe: videomemberAmit K Bhagat0:54 1 Apr '07  
GeneralRe: videomemberChard_olea0:55 1 Apr '07  
QuestionHow can i fix javascript:// error?membersheahad19:58 27 Mar '07  
AnswerRe: How can i fix javascript:// error?memberAmit K Bhagat20:00 27 Mar '07  
AnswerRe: How can i fix javascript:// error?memberAmit K Bhagat20:09 27 Mar '07  
GeneralRe: How can i fix javascript:// error?membersheahad20:33 27 Mar '07  
GeneralRe: How can i fix javascript:// error?memberAmit K Bhagat20:45 27 Mar '07  
GeneralRe: How can i fix javascript:// error?membersheahad20:51 27 Mar '07  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 22 Nov 2008
Editor: Deeksha Shenoy
Copyright 2007 by Amit K Bhagat
Everything else Copyright © CodeProject, 1999-2009
Web12 | Advertise on the Code Project