Results 1 to 2 of 2

Thread: RESOLVED!! How to display a checkbox in a Datagrid?

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member ARPRINCE's Avatar
    Join Date
    Mar 2003
    Location
    Pinoy in NJ
    Posts
    381

    Question RESOLVED!! How to display a checkbox in a Datagrid?

    How do you make a boolean column appear as a checkbox in a datagrid using VB code behind the pages?

    My original code looks like this (generated when I was designing my datagrid using the property pages):

    Code:
    <asp:BoundColumn DataField="ItemMarkDown" HeaderText="Markdown">
    <ItemStyle HorizontalAlign="Center"></ItemStyle>
    </asp:BoundColumn>
    I then went to my HTML code and replaced it with this:

    Code:
    <asp:TemplateColumn HeaderText="MarkDown">
    	<ItemTemplate>
    	<asp:CheckBox id="ItemMarkDown" runat="server" checked='<%# DataBinder.Eval
                    (Container.Dataitem, "ItemMarkDown")%>' Enabled=False />
    	</ItemTemplate>
    </asp:TemplateColumn>
    I run the page (F5) and it correctly displays the boolean field with a checkbox. However, when I try to click back to "DESIGN" tab, I get an error:

    Could not open in Design view. Place quotes around a '<% %>' block used as an attribute value or within a <Select> element.
    I tried placing quotes but that didn't work.

    Is there a way to do this on the vb code page instead of the html page?

    Any ideas?

    Thanks
    Last edited by ARPRINCE; Feb 25th, 2004 at 03:54 PM.

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