Help needed

R

Rajeev

Hi All,

I am using a datagrid control. first column of the datagrid is having a
checkbox (which used to select/deselect all the items in the grid).There is
an asp:button in the page. I want to enable/disable this delete button, if
the user selects none of the checkboxes then the button should be in
disabled state. If the user selects any of the checkboxes, the button should
get enabled.

I thought that i could use the OnCheckChanged event of the Combobox for this
purpose. But it is not working out. If i use the combobox out of the
datagrid, then onCheckChanged event is working fine.

Can anyone please suggest a solution for this problem.

Thanks in Advance,
Raj
 
G

Greg Phillips

yeah...

a little javascript might get this working...

in the html of the page.. add a script similar to:


<script language="javascript">
function checkClick()
{
if(document.all["ckLegal"].checked==true)
{
document.all["cmdNext"].disabled=false;
}else
{
document.all["cmdNext"].disabled=true;
}
}
</script>


the names of the controls will need to be replaced... (the cmdNext and the
ckLegal)

on the delete button... add the keyword disabled ...eg:
<asp:Button id="cmdNext" disabled runat="server" Text="Next"></asp:Button>


in the code of your page... add the follwoing code to the load method...

ckLegal.Attributes.Add("OnClick","checkClick();");

again.. change the ckLegal to what ever your checkbox is called..


might require some tweaking with the control names... in datagrids they seem
to get some strage ID's... im not experienced with that... possibly another
post will help you find that out...


Kind Regards
Greg Phillips
B.Sc Hons Comp Sci
www.flock.co.za
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,266
Messages
2,571,083
Members
48,773
Latest member
Kaybee

Latest Threads

Top