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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:37:38+00:00 2026-05-23T13:37:38+00:00

My goal is to display a list of tasks with checkboxes. Checking the checkbox

  • 0

My goal is to display a list of tasks with checkboxes. Checking the checkbox for a task will update the display of the task so a line-through text decoration will appear. Everythign is working great, except I can’t figure out how to initially show the list of tasks with a line-through if they are completed, or normal if the task is not completed. Here’s code excerpts:

<asp:Listview .../>
...
<ItemTemplate>
     <asp:HiddenField ID="TaskCompleted" runat="server" Value='<%#Bind("TaskCompleted")%>'/
     <asp:Checkbox ID="CompletedCheckbox" runat="server" AutoPostBack="True" OnCheckedChanged="CompletedCheckboxChange" Checked='<%#IIf(Eval("TaskCompleted"), "True", "False")%>' />
     <asp:Label id="TaskLabel" text='<%#Eval("TaskDesc")%>' runat="server" />
</ItemTemplate>
...
</asp:ListView>

Then the code behind (minus the database stuff which works fine):

Protected Sub CompletedCheckboxChange( ByVal sender As Object, ByVal e As EventArgs )

     Dim Completed As CheckBox = TryCast( sender, CheckBox )
     Dim AnnualProgramTasksId as HiddenField = TryCast(Completed.Parent.FindControl("AnnualProgramTasksId"), HiddenField)
     Dim TaskLabel As Label = TryCast(Completed.Parent.FindControl("TaskLabel"), Label)

     If Completed.Checked Then
         'update task displayed, give it a line-through
         TaskLabel.Style("text-decoration") = "line-through"
     Else
         'update task displayed, give it a line-through
         TaskLabel.Style("text-decoration") = "none"
     End If

End Sub

So this works great, when I click on a checkbox the lable gets a line-through or none based on the checkbox. Only problem is when I initially load the page, I can’t figure out how to update the style of TaskLabel to show a line-through or not. I’ve tried some various routes, but nothing is panning out. Any ideas?

  • 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-23T13:37:38+00:00Added an answer on May 23, 2026 at 1:37 pm

    This is how I have always done something like whay you are trying to.
    Try

    <asp:Label id="TaskLabel" text='<%#Eval("TaskDesc")%>' runat="server"
             OnDataBinding="TaskLabel_DataBinding" />
    

    and

    Protected Sub TaskLabel_DataBinding( ByVal sender As Object, ByVal e As EventArgs )
       Dim Completed As CheckBox = TryCast(DirectCast( sender, Control).Parent.FindControl("CompletedCheckbox"), CheckBox) 
       CompletedCheckboxChange(Completed, EventArgs.Empty)
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Goal: To display data with this list: Hour ----- 2 2,5 1 Problem: Is
Goal: Display textbox and submit button on the same line in Jquery Mobile. Problem:
Goal: Display a custom location list on google maps based on the location of
Is there a plugin or tool that will let me display a list of
My goal is to display two <div> s side-by-side with the content from both
On a Drupal app, my goal is to display a page with a couple
In the Maven document Introduction to the Build Lifecycle , a goal of display:time
My ultimate goal is to traverse an XSD document and display a TreeView (Silverlight
I have 5 Entities: Affiliation Person User UserAffiliation PersonAffiliation My goal is to display
Goal: Automatically display the first value from the enum Housing instead of displaying white

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.