DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3
  1. #1
    Brian Guest

    Enable and Disable Checkbox in Datagrid

    I have a databound checkbox as an TemplateColumn-ItemTemplate in a datagrid
    in ASP.Net. When the page loads, I want the checkbox to be disabled. However,
    when I click edit, I want the checkbox to appear enable so that then can
    check or uncheck the checkbox. When I click update, I then want the checkbox
    to be appear disabled to the user again.

    I want to do this because its stupid to keep the checkbox enabled when not
    in edit mode.

    Or in otherwords, how can I access the checkboxe's properties in the datagrid,
    and then make then appear disabled or enabled? Trying to use e.Item.cell(2).???
    is of no use.


  2. #2
    Join Date
    Jul 2008
    I know this is a very old post but I hit the same issue a few nights ago. To overcome it I found 2 options.

    1/ If you want to change the standard layout then use an EditItemStyle and define the checkbox as enabled

    2/ Attached an OnDataBindItem function that enables the control.

    Both options work it just depends on the level of layout control you want.

  3. #3
    Join Date
    Apr 2007
    Sterling Heights, Michigan
    Thank you Fred, and Welcome to DevX

    It is always good to get an answer to a question, regardless of how long it takes.

    I suspect that other folks have search on this issue, and found this thread. Unfortunately, until now, there was no response.

    Hopefully your solution will help someone in the future that has this question.

    Thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.