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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:53:01+00:00 2026-06-04T18:53:01+00:00

I am developing a simple message board in ASP.NET Web forms and I list

  • 0

I am developing a simple message board in ASP.NET Web forms and I list all posts in a ListView controller. My code looks something like this:

<ItemTemplate>
   <article class="post">
       <div class="postinfo">
           <div class="postauthor">
               Author: <strong><%# Eval("Author") %></strong>
           </div>
           <div class="postdate">
               Date: <strong><%# Eval("PostDate", "{0:D}") %></strong>
           </div>
           <div class="postvotes">
               <asp:Button class="postupvote" id='up<%# Eval("Id") %>' runat="server" />
               <asp:Label ID="postvotescount_<%# Eval("Id") %>" class="postvotescount" runat="server" Text="<%# Eval("Votes") %> votes"></asp:Label>
               <asp:Button class="postdownvote" id='down<%# Eval("Id") %>' runat="server" />
           </div>
       </div>
       <div class="postcontent"><%# Eval("Text") %></div>
   </article>
</ItemTemplate>

My problem is the voting functionality. I want to have css id properties, containing the unique database id of the post. That way I will know the Id of the post, it was voted for. So is this possible and if not, how can I achieve this?

Thanks!

  • 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-06-04T18:53:04+00:00Added an answer on June 4, 2026 at 6:53 pm

    You could use ClientIdMode and set it to predictable

    http://msdn.microsoft.com/en-us/library/system.web.ui.clientidmode.aspx

    <asp:ListView ID="ListView1" 
                  ClientIDMode="Predictable" 
                  ClientIDRowSuffix="ProductID"  
                  DataSourceID="XmlDataSource1" runat="server" >
    <ItemTemplate>
    </ItemTemplate>
    </asp:ListView>
    

    This assumes you are using .Net 4.0 or above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

to all. i developing a webpage using asp.net with c# language, in this webpage
I have trouble sending a message via NServiceBus. I have an ASP.Net MVC web
I'm developing the most simple ASP.NET application which is giving me an annoying error.
I am developing a simple application which has to send an SMS message from
We are developing a simple web application in JSF in which there is a
I am developing a simple rating system for my employer's profile based web-app. Here
I'm developing a simple website in VS 2010 that uses master pages. All pages
Currently developing an ASP.NET WebApplication with VS2008. I stopped development for a few weeks,
Recently I am developing a online platform using ASP.NET MVC 3, and I have
am using Os X 10.6.4 and X code Version 3.2.3 for developing some simple

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.