Ask a Question related to ASP.NET Data Grid Control, Design and Development.
-
Philip Yeo #1
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
-
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... -
Stevie_mac #2
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
-
Philip Yeo #3
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...so, then> Just a theory but... does your loaddata() function rebind the grid? Ifthat> 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 tableobject.> > has this button so the controls(0) is actually returning an arrayany> >
> > Thus would it be wise to write the code this way. Pls advice if there's>> > 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
-
Stevie_mac #4
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...> so, then> > Just a theory but... does your loaddata() function rebind the grid? If> that> > 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> object.> > > has this button so the controls(0) is actually returning an array> any> > >
> > > Thus would it be wise to write the code this way. Pls advice if there's>> >> > > 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



Reply With Quote

