Link to home
Start Free TrialLog in
Avatar of Webboy2008
Webboy2008

asked on

asp.net radiobutton

if RdoProjectSpecialHazardYes.checked then TxtProjectSpecialHazardDescription.readonly == false
if RdoProjectSpecialHazardNo.checked then TxtProjectSpecialHazardDescription.readonly == true

How to add both condition in asp.net / c#? I would like code behind to do the validation check.

Thanks

<cc1:OboutRadioButton  
                        FolderStyle="../app/UIStyleControls/Obout/Interface/styles/plain/OboutRadioButton" 
                        ID="RdoProjectSpecialHazardYes" runat="server" Text="YES" 
                        GroupName="RdoProjectSpecialHazard" 
                        ></cc1:OboutRadioButton>
           
                    <cc1:OboutRadioButton  
                        FolderStyle="../app/UIStyleControls/Obout/Interface/styles/plain/OboutRadioButton" 
                        ID="RdoProjectSpecialHazardNo"  runat="server" Text="NO"                           
                        GroupName="RdoProjectSpecialHazard"             
                        ></cc1:OboutRadioButton>
                        <br /><br />
              
                  <cc1:OboutTextBox    
                 ToolTip="Please describe..." 
                 ID="TxtProjectSpecialHazardDescription" 
                 TextMode="MultiLine" Height="100" Width="300" runat="server">
                 </cc1:OboutTextBox></div>

Open in new window

Avatar of nishant joshi
nishant joshi
Flag of India image

using C# it is possible but which is not a good solution for this task..


added a code with JQuery.Check..


Regards,
<cc1:OboutRadioButton  
                        FolderStyle="../app/UIStyleControls/Obout/Interface/styles/plain/OboutRadioButton" 
                        ID="RdoProjectSpecialHazardYes" runat="server" Text="YES" 
                        GroupName="RdoProjectSpecialHazard" onclick="javascript:RadioClick();"
                        ></cc1:OboutRadioButton>
           
                    <cc1:OboutRadioButton  
                        FolderStyle="../app/UIStyleControls/Obout/Interface/styles/plain/OboutRadioButton" 
                        ID="RdoProjectSpecialHazardNo"  runat="server" Text="NO"                           
                        GroupName="RdoProjectSpecialHazard" onclick="javascript:RadioClick();"            
                        ></cc1:OboutRadioButton>
                        <br /><br />
              
                  <cc1:OboutTextBox    
                 ToolTip="Please describe..." 
                 ID="TxtProjectSpecialHazardDescription" 
                 TextMode="MultiLine" Height="100" Width="300" runat="server">
                 </cc1:OboutTextBox></div>

Open in new window

function RadioClick(){
if($("#RdoProjectSpecialHazardYes").attr('Checked')){
$("#TxtProjectSpecialHazardDescription").attr("ReadOnly","true");
}
if($("#RdoProjectSpecialHazardNo").attr('Checked')){
$("#TxtProjectSpecialHazardDescription").attr("ReadOnly","fa;se");
}
}

Open in new window

Avatar of Webboy2008
Webboy2008

ASKER

your codes do not seem working
and i prefer code behind since most of codes using code behind for validation. Thanks
Try like this:

TxtProjectSpecialHazardDescription.readonly = ((!RdoProjectSpecialHazardYes.checked || RdoProjectSpecialHazardNo.checked) ? true : false);

Open in new window

can u show me in if statement?
That is an if statement!

See:  http://en.wikipedia.org/wiki/%3F:
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial