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 3354736
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:18:35+00:00 2026-05-18T02:18:35+00:00

I have a listview control on an .aspx page. Inside this list view i

  • 0

I have a listview control on an .aspx page. Inside this list view i want to check “Type” property which comes from database. here is the example code :

 <ItemTemplate>
         <%# if(Convert.ToInt32(DataBinder.Eval(Container.DataItem,"Type")) == 0){ %>
            <tr class="item">
                <td>
                    <%# Convert.ToDateTime(Eval("WorkDate")).ToShortDateString() %>
                </td>
                <td style="text-align: center;">
                    <%# Eval("SkillName") %>
                </td>
             </tr>
         <%# } else if (Convert.ToInt32(DataBinder.Eval(Container.DataItem,"Type")) == 1) {%>
             <tr class="item">
                <td colspan="2">
                    <strong><%# Convert.ToDateTime(Eval("WorkDate")).ToShortDateString() %></strong>
                </td>
             </tr>
          <% } %>
  </ItemTemplate>

As a last resort i tried to user DataBinder.Eval() but i get the exception “Expected class, delegate, enum, interface, or struct”. What can i be doing wrong? Writing a function in code-behind isn’t an option for me. Is there a way to achieve this?

  • 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. Editorial Team
    Editorial Team
    2026-05-18T02:18:35+00:00Added an answer on May 18, 2026 at 2:18 am

    Untested, as I don’t have Visual Studio available at the moment, but since HtmlTableRow has a Visible property, the following should work:

    <tr class="item" runat="server" Visible='<%# Convert.ToInt32(Eval("Type")) == 0 %>'>
        ...
    </tr>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list view control which at the moment only allows one item
I have only single Default.aspx page and a single ListView Control. Why am I
I have an asp:ListView control which list playlists. It has paging supported and holds
I have a Listview control lstStudents and i have added checkboxes inside the List
I have a ListView on a page that displays a list of widgets. When
Say i have a TextBox control inside of a ListView where the text is
I have a SQLDataSource that is bound to a ListView control but I want
I have a Jquery dialog with an ASP listview control inside. Before showing the
I have a WPF ListView control for which I am dynamically creating columns. One
I have a ListView control, and I'm trying to figure out the easiest/best way

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.