Professional Web Applications Themes

ReadOnly checkbox in datagrid - ASP.NET Data Grid Control

Hi Group, I have a checkbox column in a web datagrid which is related to a "Product in stock" property. The grid is in view mode, so the user can't (and shouldn't) change anything in the grid. What I need is to show a "ReadOnly" checkbox in the grid, but not a disabled one (grayed out). I'm using a template column and the only property I can set is "enabled". There is no "ReadOnly" attribute like for the <INPUT type=... > HTML controls Anyone knows how to do that ? And I don't want to replace the checkbox with letters ...

  1. #1

    Default ReadOnly checkbox in datagrid

    Hi Group,

    I have a checkbox column in a web datagrid which is related to a "Product in
    stock" property.
    The grid is in view mode, so the user can't (and shouldn't) change anything
    in the grid.

    What I need is to show a "ReadOnly" checkbox in the grid, but not a disabled
    one (grayed out).
    I'm using a template column and the only property I can set is "enabled".

    There is no "ReadOnly" attribute like for the <INPUT type=... > HTML
    controls

    Anyone knows how to do that ?

    And I don't want to replace the checkbox with letters or words, like Y/N,
    Yes/No, etc. It has to stay a checkbox.

    This is the code I use:

    <ItemTemplate>
    <asp:CheckBox
    id=chkInStock
    Checked='<%# DataBinder.Eval(Container, "DataItem.InStock") %>'
    Runat="server"
    Enabled=False > *** to be replaced...***
    </asp:CheckBox>
    </ItemTemplate>

    Many thanks.
    Andrei.


    andrei Guest

  2. #2

    Default Readonly checkbox in Datagrid

    Hi Group,

    I have a checkbox column in a web datagrid which is related to a "Product in
    stock" property.
    The grid is in view mode, so the user can't (and shouldn't) change anything
    in the grid.

    What I need is to show a "ReadOnly" checkbox in the grid, but not a disabled
    one (grayed out).
    I'm using a template column and the only property I can set is "enabled".

    There is no "ReadOnly" attribute like for the <INPUT type=... > HTML
    controls

    Anyone knows how to do that ?

    And I don't want to replace the checkbox with letters or words, like Y/N,
    Yes/No, etc. It has to stay a checkbox.

    This is the code I use:

    <ItemTemplate>
    <asp:CheckBox
    id=chkInStock
    Checked='<%# DataBinder.Eval(Container, "DataItem.InStock") %>'
    Runat="server"
    Enabled=False > *** to be replaced...***
    </asp:CheckBox>
    </ItemTemplate>

    Many thanks.
    Andrei.



    andrei Guest

  3. #3

    Default Re: ReadOnly checkbox in datagrid

    What if you want it to be editable only when the corresponding row is being
    edited?


    "Prasad" <prasadh_mshotmail.com> wrote in message
    news:%23nFOWSzVDHA.2012TK2MSFTNGP10.phx.gbl...
    > Hi
    >
    > This will generate checkbox and you will not be able to uncheck it. Add
    the
    > onclick to the checkbox.Note it should runat clientend and not at server
    >
    > <input type=checkbox onclick="this.checked=true" checked>
    >
    > HTH
    > Prasad
    >
    > "andrei" <andrei.tomaera-environmental.com> wrote in message
    > news:emrkqJqVDHA.2016TK2MSFTNGP09.phx.gbl...
    > > Hi Group,
    > >
    > > I have a checkbox column in a web datagrid which is related to a
    "Product
    > in
    > > stock" property.
    > > The grid is in view mode, so the user can't (and shouldn't) change
    > anything
    > > in the grid.
    > >
    > > What I need is to show a "ReadOnly" checkbox in the grid, but not a
    > disabled
    > > one (grayed out).
    > > I'm using a template column and the only property I can set is
    "enabled".
    > >
    > > There is no "ReadOnly" attribute like for the <INPUT type=... > HTML
    > > controls
    > >
    > > Anyone knows how to do that ?
    > >
    > > And I don't want to replace the checkbox with letters or words, like
    Y/N,
    > > Yes/No, etc. It has to stay a checkbox.
    > >
    > > This is the code I use:
    > >
    > > <ItemTemplate>
    > > <asp:CheckBox
    > > id=chkInStock
    > > Checked='<%# DataBinder.Eval(Container, "DataItem.InStock") %>'
    > > Runat="server"
    > > Enabled=False > *** to be replaced...***
    > > </asp:CheckBox>
    > > </ItemTemplate>
    > >
    > > Many thanks.
    > > Andrei.
    > >
    > >
    >
    >

    Tony Guest

Similar Threads

  1. CheckBox in Datagrid
    By deven_delian20031977 in forum Macromedia Flash Data Integration
    Replies: 1
    Last Post: June 27th, 12:52 PM
  2. Replies: 4
    Last Post: June 13th, 02:29 AM
  3. Replies: 0
    Last Post: April 6th, 10:14 AM
  4. REPOST: Column [blah] is readonly on Datagrid UpdateCommand event
    By Learning SQL Server in forum ASP.NET General
    Replies: 2
    Last Post: August 7th, 01:10 PM
  5. Readonly Checkbox?
    By John Kievlan in forum ASP.NET
    Replies: 3
    Last Post: July 30th, 04:06 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139