ReadOnly checkbox in datagrid

Ask a Question related to ASP.NET Data Grid Control, Design and Development.

  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. Similar Questions and Discussions

    1. Howto bind CheckBox to the datagrid/ Then update the database field when the checkbox is clicked.
      I am trying to update the database field when the checkbox is clicked. I am trying to modified the following solution but.. got stuck on the...
    2. how to add checkbox to a datagrid?
      Hello, I am trying to add a checkbox to a datagrid. But i dont want to bind a data with the checkBox. I only want to know if any user has chacked...
    3. Added CheckBox to a DataGrid Doesn't work with DataGrid.Enabled=False
      I have created a Template Column and Added to a Datagrid, which contains a checkBox. The column is not Binded to any column of the Dataset, but is...
    4. REPOST: Column [blah] is readonly on Datagrid UpdateCommand event
      Forgive the repost, but this is really troublesome and I hope SOMEONE can shed some light on it. I am trying to update a datarow via in-place...
    5. Readonly Checkbox?
      Well, I'm sure you guys know that the ASP.NET Checkbox control doesn't have a Readonly property. I'm writing an application where I need it to...
  3. #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

  4. #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_ms@hotmail.com> wrote in message
    news:%23nFOWSzVDHA.2012@TK2MSFTNGP10.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.toma@era-environmental.com> wrote in message
    > news:emrkqJqVDHA.2016@TK2MSFTNGP09.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

Posting Permissions

  • You may not post new threads
  • You may 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