How to diable buttoncolumn's

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

  1. #1

    Default How to diable buttoncolumn's

    Just a question,

    If I have a column that performs delete. But I want to disable all the
    delete buttons in this column when user click's on edit,

    I put this code here,

    Protected sub mydatagrid_edit(sender as object, e as
    datagridcommandeventargs)

    mydatagrid.edititemindex = cint(e.item.itemindex)
    ' because it is in the 2nd col item's integer parameter is 1
    dim btnDel as button = e.item(1).controls(0)
    btnDel.enable = false
    loaddata()

    end sub

    However this doesn't work.
    So I figured that it could be because there's a whole row of the table that
    has this button so the controls(0) is actually returning an array object.

    Thus would it be wise to write the code this way. Pls advice if there's any
    mistake

    Protected sub mydatagrid_edit(sender as object, e as
    datagridcommandeventargs)

    mydatagrid.edititemindex = cint(e.item.itemindex)
    ' because it is in the 2nd col item's integer parameter is 1
    dim btnDel() as button = e.item(1).controls(0)
    dim i as integer
    for i = 0 to btnDel.count
    btnDel(i).enable = false
    next i
    loaddata()

    end sub


    Philip Yeo Guest

  2. Similar Questions and Discussions

    1. diable backspace key's Browser control
      I have a html page with a SWF file. The SWF uses Anchors for the user to utilize the browser functions (back & forward). I have input text fields...
  3. #2

    Default Re: How to diable buttoncolumn's

    Just a theory but... does your loaddata() function rebind the grid? If so, then
    put the btnDel.enable = false after loaddata()

    "Philip Yeo" <philip_yeo@azagsoft.com> wrote in message
    news:e0l6h7uYDHA.2648@TK2MSFTNGP09.phx.gbl...
    > Just a question,
    >
    > If I have a column that performs delete. But I want to disable all the
    > delete buttons in this column when user click's on edit,
    >
    > I put this code here,
    >
    > Protected sub mydatagrid_edit(sender as object, e as
    > datagridcommandeventargs)
    >
    > mydatagrid.edititemindex = cint(e.item.itemindex)
    > ' because it is in the 2nd col item's integer parameter is 1
    > dim btnDel as button = e.item(1).controls(0)
    > btnDel.enable = false
    > loaddata()
    >
    > end sub
    >
    > However this doesn't work.
    > So I figured that it could be because there's a whole row of the table that
    > has this button so the controls(0) is actually returning an array object.
    >
    > Thus would it be wise to write the code this way. Pls advice if there's any
    > mistake
    >
    > Protected sub mydatagrid_edit(sender as object, e as
    > datagridcommandeventargs)
    >
    > mydatagrid.edititemindex = cint(e.item.itemindex)
    > ' because it is in the 2nd col item's integer parameter is 1
    > dim btnDel() as button = e.item(1).controls(0)
    > dim i as integer
    > for i = 0 to btnDel.count
    > btnDel(i).enable = false
    > next i
    > loaddata()
    >
    > end sub
    >
    >

    Stevie_mac Guest

  4. #3

    Default Re: How to diable buttoncolumn's

    Yup,

    Load data rebinds the dataset to the datagrid...

    "Stevie_mac" <no.email@please.com> wrote in message
    news:bhma7l$5e6$1@newsg3.svr.pol.co.uk...
    > Just a theory but... does your loaddata() function rebind the grid? If
    so, then
    > put the btnDel.enable = false after loaddata()
    >
    > "Philip Yeo" <philip_yeo@azagsoft.com> wrote in message
    > news:e0l6h7uYDHA.2648@TK2MSFTNGP09.phx.gbl...
    > > Just a question,
    > >
    > > If I have a column that performs delete. But I want to disable all the
    > > delete buttons in this column when user click's on edit,
    > >
    > > I put this code here,
    > >
    > > Protected sub mydatagrid_edit(sender as object, e as
    > > datagridcommandeventargs)
    > >
    > > mydatagrid.edititemindex = cint(e.item.itemindex)
    > > ' because it is in the 2nd col item's integer parameter is 1
    > > dim btnDel as button = e.item(1).controls(0)
    > > btnDel.enable = false
    > > loaddata()
    > >
    > > end sub
    > >
    > > However this doesn't work.
    > > So I figured that it could be because there's a whole row of the table
    that
    > > has this button so the controls(0) is actually returning an array
    object.
    > >
    > > Thus would it be wise to write the code this way. Pls advice if there's
    any
    > > mistake
    > >
    > > Protected sub mydatagrid_edit(sender as object, e as
    > > datagridcommandeventargs)
    > >
    > > mydatagrid.edititemindex = cint(e.item.itemindex)
    > > ' because it is in the 2nd col item's integer parameter is 1
    > > dim btnDel() as button = e.item(1).controls(0)
    > > dim i as integer
    > > for i = 0 to btnDel.count
    > > btnDel(i).enable = false
    > > next i
    > > loaddata()
    > >
    > > end sub
    > >
    > >
    >
    >

    Philip Yeo Guest

  5. #4

    Default Re: How to diable buttoncolumn's

    So your sorted now! Right?
    you did try putting the btnDel.enable = false after loaddata()


    "Philip Yeo" <philip_yeo@azagsoft.com> wrote in message
    news:%23AdhaBUZDHA.1748@TK2MSFTNGP12.phx.gbl...
    > Yup,
    >
    > Load data rebinds the dataset to the datagrid...
    >
    > "Stevie_mac" <no.email@please.com> wrote in message
    > news:bhma7l$5e6$1@newsg3.svr.pol.co.uk...
    > > Just a theory but... does your loaddata() function rebind the grid? If
    > so, then
    > > put the btnDel.enable = false after loaddata()
    > >
    > > "Philip Yeo" <philip_yeo@azagsoft.com> wrote in message
    > > news:e0l6h7uYDHA.2648@TK2MSFTNGP09.phx.gbl...
    > > > Just a question,
    > > >
    > > > If I have a column that performs delete. But I want to disable all the
    > > > delete buttons in this column when user click's on edit,
    > > >
    > > > I put this code here,
    > > >
    > > > Protected sub mydatagrid_edit(sender as object, e as
    > > > datagridcommandeventargs)
    > > >
    > > > mydatagrid.edititemindex = cint(e.item.itemindex)
    > > > ' because it is in the 2nd col item's integer parameter is 1
    > > > dim btnDel as button = e.item(1).controls(0)
    > > > btnDel.enable = false
    > > > loaddata()
    > > >
    > > > end sub
    > > >
    > > > However this doesn't work.
    > > > So I figured that it could be because there's a whole row of the table
    > that
    > > > has this button so the controls(0) is actually returning an array
    > object.
    > > >
    > > > Thus would it be wise to write the code this way. Pls advice if there's
    > any
    > > > mistake
    > > >
    > > > Protected sub mydatagrid_edit(sender as object, e as
    > > > datagridcommandeventargs)
    > > >
    > > > mydatagrid.edititemindex = cint(e.item.itemindex)
    > > > ' because it is in the 2nd col item's integer parameter is 1
    > > > dim btnDel() as button = e.item(1).controls(0)
    > > > dim i as integer
    > > > for i = 0 to btnDel.count
    > > > btnDel(i).enable = false
    > > > next i
    > > > loaddata()
    > > >
    > > > end sub
    > > >
    > > >
    > >
    > >
    >
    >

    Stevie_mac 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