Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 radio group query

Author  Topic 

DesiGal
Starting Member

31 Posts

Posted - 2011-04-05 : 16:01:18
On my ASPxGrid I have two columns approve and Deny both the columns are of boolean type(Radio buttons)
In a particular row if a user selects the radio button for the approve column then the radio button for Deny column should be unselected and vice versa.

I also have a header radio button for each of these columns. So if the header radio is selected then the corresponding radio buttons from that column should be selected and all the radio buttons from the other columns should be unselected.
I am dynamically creating these radio buttons for each column
<DataItemTemplate>
<dx:ASPxRadioButton ID="chkAppDataItem" runat="server" >
</dx:ASPxRadioButton>
</DataItemTemplate>

<HeaderCaptionTemplate>
<dx:ASPxRadioButton ID="chkAppHeader" runat="server" >
dx:ASPxRadioButton>
</HeaderCaptionTemplate>

Can I achieve this functionality with javascript?

ajthepoolman
Constraint Violating Yak Guru

384 Posts

Posted - 2011-04-06 : 12:11:01
Here is what I use for checkboxes: (perhaps it could be tweaked for radio buttons, not sure though)

<script type="text/javascript">

function checkAll() {
if (document.FORM_NAME.chkAppHeader.checked == true) {
for (var i = 0; i < document.FORM_NAME.chkAppDataItem.length; i++) {
document.FORM_NAME.chkAppDataItem[i].checked = true;
}
}
else {
for (var i = 0; i < document.FORM_NAME.chkAppDataItem.length; i++) {
document.FORM_NAME.chkAppDataItem[i].checked = false;
}
}
}

</script>

On your header control you could add <dx:ASPxRadioButton ID="chkAppHeader" runat="server" onclick="checkAll();">

This is completely untested and thrown together based on code to check and uncheck all checkboxes. Hope it helps.

Hey, it compiles.
Go to Top of Page

cns1202
Starting Member

7 Posts

Posted - 2011-04-08 : 07:59:02
quote:
Originally posted by DesiGal

On my ASPxGrid I have two columns approve and Deny both the columns are of boolean type(Radio buttons)
In a particular row if a user selects the radio button for the approve column then the radio button for Deny column should be unselected and vice versa.

I also have a header radio button for each of these columns. So if the header radio is selected then the corresponding radio buttons from that column should be selected and all the radio buttons from the other columns should be unselected.
I am dynamically creating these radio buttons for each column
<DataItemTemplate>
<dx:ASPxRadioButton ID="chkAppDataItem" runat="server" >
</dx:ASPxRadioButton>
</DataItemTemplate>

<HeaderCaptionTemplate>
<dx:ASPxRadioButton ID="chkAppHeader" runat="server" >
dx:ASPxRadioButton>
</HeaderCaptionTemplate>

Can I achieve this functionality with javascript?




Hi did you try the MutuallyExclusiveCheckBoxExtender.That could help you withut javascript if you belive in ajax :)

Regards,
Chirag Shah
Go to Top of Page
   

- Advertisement -