Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 166581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T12:07:22+00:00 2026-05-11T12:07:22+00:00

I currently have a Gridview that displays TypeID , Name , Description. I would

  • 0

I currently have a Gridview that displays

TypeID , Name , Description.

I would like to display the actual type name instead of the TypeID in the gridview. I created this function that takes in the ID and returns the Name but I am having trouble using it. There are 15-20 different types so How do I convert the TypeID to a Type Name so that it is displayed when the Gridview is rendered.

protected string GetGenericTypeByID(int genericTypeID)         {             string genericTypeName;              GenericType.Generic_TypeDataTable genericTypeNameDS = new GenericType.Generic_TypeDataTable();             genericTypeNameDS = GenericBO.Get_GenericTypeByID(genericTypeID);              genericTypeName = genericTypeNameDS[0]['Generic_Type_Name'].ToString();                      return genericTypeName;          } 

I thought I would be able to use the function in the ItemTemplate but it seems to be harder that I thought

 <ItemTemplate>                     <asp:Label ID='Label1' runat='server' Text='<%# Bind('GetGenericTypeByID('Generic_Type_ID')')%>'></asp:Label>                 </ItemTemplate> 

Thanks to Everyone who helped me solve this problem. I ended up using the method below and it works perfectly. GetGenericTypeByID( Convert.ToInt32(Eval(‘Generic_Type_ID’)))

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T12:07:23+00:00Added an answer on May 11, 2026 at 12:07 pm

    You’ve got the ‘bind/eval’ and method call inside out.
    See Using Method inside a DataGrid or GridView TemplateField

    <asp:TemplateField HeaderText=”Name”> <ItemTemplate>     <a href='<%# FormatUrl(Eval(”email1″).ToString())%>'><%# Eval(”fname”) %>,&nbsp;<%# Eval(”lname”) %></a> </ItemTemplate> 

    With the ‘FormatUrl’ function being:

    public string FormatUrl(string email) {     return “mailto:” + email; } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 91k
  • Answers 91k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer How to kill a Thread is a difficult question. There… May 11, 2026 at 6:15 pm
  • Editorial Team
    Editorial Team added an answer I'm not sure I understand why you need anything special.… May 11, 2026 at 6:15 pm
  • Editorial Team
    Editorial Team added an answer You should look at the XMPP stuff. It is all… May 11, 2026 at 6:15 pm

Related Questions

I have a number of tables in my DB that hold references to an
I have a gridview that could end up displaying about 5K records. I currently
I currently have an ASP.NET GridView that displays a few columns to the user
I have a listview that is binded to a ThreadSafeObservableCollection. The background of each

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.