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

Related Questions

I have a page that houses an asp GridView and I would like to
I currently have an ASP.NET GridView that displays a few columns to the user
I currently have an asp:GridView that displays a few BoundFields and then one asp:TemplateField
I currently have a gridview that has an asp:ButtonField as one of the columns.
I have a GridView that displays several dozen rows worth of a custom layout,
I have a fairly standard ASP.NET GridView that displays 2 columns that have a
In my Webforms 3.5 application, I have a GridView of users that displays the
I have a gridview that could end up displaying about 5K records. I currently
I currently have a gridview that is set up and working properly but I
I have a GridView that's displaying a bunch of name/value combinations. The name column

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.