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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:54:18+00:00 2026-05-27T23:54:18+00:00

I have a form with containing a datalist which is bound to a datasource

  • 0

I have a form with containing a datalist which is bound to a datasource which contains a list of items and a true/false flag. If true, the myCheck checkbox is checked:

<form id="myForm" runat="server">
    <asp:Button ID="save" runat="server" Text="Save" OnClick="save_Click" />
    <br />
    <asp:DataList runat="server" id="myList" onitemdatabound="myList_ItemDataBound">
    <HeaderTemplate>
        <th>Item Name</th>
        <th id="thCheck" runat="server">Check?</th>
    </HeaderTemplate>
    <ItemTemplate>
        <td id="tdName" runat="server"><%# Eval("Name") %></td>
        <td runat="server"><asp:CheckBox id="myCheck" runat="server" Checked="false" /></td>
    </ItemTemplate>
</asp:DataList>

On clicking save, I want to see which items have been checked. I am using the following to iterate through the items in the datalist:

protected void save_Click(Object sender, EventArgs e)
{
    String Name;
    Boolean omit;

    foreach (DataListItem item in myList.Items)
    {
        CheckBox omitCheck = (CheckBox)item.FindControl("myCheck");

        if (omitCheck != null)
        {
            if (omitCheck.Checked == true) // This line is my problem!!
            {
                // do stuff
            }
            break;
        }
    }

FindControl appears to work ok and returns a checkbox, however the value is always false, even if I have checked some of the boxes. If I set the value of the checkboxes to True in the aspx page, omitCheck.Checked is always true. ViewState is not disabled.

I’m new to this so sure there is an obvious answer.

  • 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-27T23:54:19+00:00Added an answer on May 27, 2026 at 11:54 pm

    what does the myList_ItemDataBound function look like? I suspect it needs a !IsPostback to not override entered values on the postback

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

Sidebar

Related Questions

Using PHP, I have a form containing a simple list of items with a
I have one form containing one checkbox(not checkbox list)and one textfield. If the checkbox
I have a HTML form containing checkboxes in the form of .. <input type=checkbox
I have a form containing a TextBox in C# which I set to a
I have a scenario which is as follows:- A form containing 2 grids. The
I have a WebView which has a form containing 10 editboxes. When I type
I have a form containing a list of input fields that the user populates
Assume I have a vanilla form containing a selection list and a submit button:
I have a form (todo list) containing labels/checkboxes (todos) as follows: <form class=tasklist> These
I have a simple in VB/ASP.NET form containing two text boxes, I am attempting

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.