Results 1 to 3 of 3

Thread: Problem with Checkboxes in the DataGrid <Resolved>

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Malaysia
    Posts
    345

    Problem with Checkboxes in the DataGrid <Resolved>

    Hi!
    I am working on an Asp.net application with c# as the code behind. A newbie.

    I have a datagrid, in which I am showing checkbox (bound to a column of my table).

    My code is

    Code:
    <asp:CheckBox id="chkActive" enabled= "false" AutoPostBack="True" Runat="server" checked='<%# DataBinder.Eval(Container.DataItem, "status")  %>'>
    </asp:CheckBox>
    The datatype of the 'Status' field in the database is bit. ( I am using Sql Server 2000). It works perfectly fine.

    But, due to some reason, when I change the datatype of the Status field to int, it doesn't work. How to implement checboxes in the grid, when the datatype is int.

    Pls help.

    Thanks.
    Last edited by sinha; Aug 4th, 2005 at 03:22 PM.
    Thanks.

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091

    Re: Problem with Checkboxes in the DataGrid

    Try this...
    Code:
    checked='<%# Convert.ToBoolean(DataBinder.Eval(Container.DataItem, "status"))  %>'
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Malaysia
    Posts
    345

    Re: Problem with Checkboxes in the DataGrid

    Thanks a bunch.
    Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width