troubleshooting Question

Set Gridview ItemTemplate Label to Related Table Column Value

Avatar of ACE-ITFLA
ACE-ITFLAFlag for United States of America asked on
.NET ProgrammingASP.NET
6 Comments1 Solution583 ViewsLast Modified:
Developing in ASP.Net 2.0 with VS2005 and using SQLExpress on Windows XP SP2.

I may not use the correct terminology so I apologize in advance.

I've created a gridview control on a web page. One of the columns in the gridview is called ContacID. The ContactID field is an integer value which corresponds to a primary key value in my Contacts table. If I use a Label control in the ItemTemplate for the ContactID column, it displays the integer value in the gridview list on the rendered web page. What I would like is to show the ContactName field from the Contacts table in the ItemTemplate control. I don't want to use a DropDwonList control in the ItemTemplate because then I would have to set its Enabled property to False to prevent it from being updated.

I feel there must be a standard way of doing this but, being a newbie and not understanding all the terminology yet, I just can't find the answer. I'm an expert VB6 programmer but my ASP.Net understanding is coming quite slow.


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros