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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T22:20:50+00:00 2026-06-18T22:20:50+00:00

I am using ASP.NET 4.5 Model Binding to present items in a ListView control

  • 0

I am using ASP.NET 4.5 Model Binding to present items in a ListView control with editing.

<asp:ListView ID="Results" runat="server" SelectMethod="SelectClientStatus" DataKeyNames="ID" ItemPlaceholderID="itemPlaceHolder" ItemType="ClientStatus" OnItemCommand="Results_ItemCommand" InsertItemPosition="LastItem" UpdateMethod="UpdateClientStatus" InsertMethod="InsertClientStatus">
    <LayoutTemplate>
        <table>
            <tr>
                <th runat="server">
                    <asp:LinkButton ID="SortByDescription" runat="server" ClientIDMode="Static" CommandName="Sort" CommandArgument="Description" Text="Description" />
                </th>
                <th>Active</th>
                <th></th>
            </tr>
            <asp:PlaceHolder ID="itemPlaceHolder" runat="server" />
        </table>
        <agp:PagerControl runat="server" ID="PagerControl" />
    </LayoutTemplate>
    <ItemTemplate>
        <tr>
            <td>
                <%#: Item.Description%>
            </td>
            <td>
                <%#: Item.IsClientActive %>
            </td>
            <td>
                <asp:LinkButton ID="Edit" runat="server" ClientIDMode="Static" CommandName="Edit" CommandArgument="<%#: Item.ID %>" Text="Edit" />
            </td>
        </tr>
    </ItemTemplate>
</asp:ListView>

When I add my EditItemTemplate, I have a Checkbox and I am trying to bind the Checked property to the model…

<EditItemTemplate>
    <tr>
        <td>
            <asp:TextBox ID="Description" runat="server" Text="<%#: BindItem.Description%>" />
        </td>
        <td>
            <asp:CheckBox ID="IsActive" runat="server" Checked="<%#: BindItem.IsClientActive %>" />
        </td>
        <td>
            <asp:LinkButton ID="Update" runat="server" ClientIDMode="Static"
                CommandName="Update" CommandArgument="<%#: Item.ID %>"
                Text="Update" />
            <asp:LinkButton ID="Cancel" runat="server" ClientIDMode="Static"
                CommandName="Cancel" CommandArgument="<%#: Item.ID %>"
                Text="Cancel" />
        </td>
    </tr>
</EditItemTemplate>

This is where the problem starts, running the page now shows a message of “CS0030: Cannot convert type ‘string’ to ‘bool'”, prompting with the line…

<td>
<asp:CheckBox ID="IsActive" runat="server" Checked="<%#: BindItem.IsClientActive %>" />
</td>

What have I missed? How do I bind the value of IsClientActive to the Checked property of the Checkbox control? It is worth noting that, within the model, the IsClientActive property is defined as a Boolean and not nullable.

  • 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-18T22:20:51+00:00Added an answer on June 18, 2026 at 10:20 pm

    My bad; Checked="<%#: BindItem.IsClientActive %>" should have been Checked="<%# BindItem.IsClientActive %>" (note the omission of the colon (:))

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

Sidebar

Related Questions

I am using asp.net mvc 2.0(default binding model) and I have this problem. I
I have a webforms project and I'm using the new Model Binding on ASP.NET
I'm using ASP.NET MVC and have a model which has an image (byte array)
I'm using ASP.NET MVC 2 and here's the issue. My View Model looks something
I am using ASP.NET MVC 2, and am using a view-model per view approach.
I am trying to create a drop down list using asp.net mvc. Model: public
I am using custom model binder in ASP.NET MVC 2 that looks like this:
This is my model of my asp.net mvc 2 project : using System; using
In ASP.NET MVC3, when a view model is passed into a view using return
I'm using the DataAnnotations attributes along with ASP.Net MVC 2 to provide model validation

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.