Hi Every one
i created dynamic radio button and i add OnClick event on that and i write java script for enable and disable the button depending upon some status the event is firing from the radio button and i able to check the status when i try to enable or disable the button i am getting the error document.getelementById is null or not an object i will show you the code which is am using
function RadioEvent(Status,Button) { // var Button1='<%=btnAccept.ClientID %>'; // aler(document.getElementById(Button1).Text); if(Status=="Request Accepted") { document.getElementById(Button).Enabled = true; // document.getElementById('btnAccept').disabled=true; //document.getElementById(Button1).setAttribute('Enabled','true'); //document.getElementById(Button).disabled = true; //alert(Status); //document.getElementById('btnDecline').Enabled=false; //document.getElementById('btnAccept').Enabled = true; } else document.form1.btnDecline.Enable=true; //document.getElementById(Button1).removeAttribute('Enabled'); //document.getElementById(btnDecline).disabled = false; }
|
the above is my java script and i am calling event like this
MyRadioButton.Attributes.Add("onclick", "RadioEvent('" + Status + "','btnDecline');");
|
please correct me where i am doing mistake
mohdazeemuddin ahmedPosted Apr 5, 2010, 2:08 AM
i want to disable or enable this two button depending upon status column when user check on radio button please give me the solution to achieve my task i tried the suggestion of Mr.Amit and Mr.Sam but i got the same error please its very urgent
thanks in advance
mohdazeemuddin ahmedPosted Apr 3, 2010, 2:39 AM
To Jaish Mathewsir i am creating radio button dynamically so i can't use your Suggest way but thanks for your reply
Jaish MathewsPosted Apr 1, 2010, 1:50 PM
<input type ="radio" id="r1" onclick="RadioEvent('status',this);" />
<input type ="radio" id="r2" onclick="RadioEvent('status',this);" />
function RadioEvent(Status, Button) {
Button.disabled = true;
}
Sam HobbsPosted Apr 1, 2010, 12:28 PM
Will work, but you need to use quotes for btnDecline, as Amit says.
Also note that if you want the text in a button, use:
"value")
mohdazeemuddin ahmedPosted Apr 1, 2010, 4:17 AM
thanks
Amit ChoudharyPosted Apr 1, 2010, 4:03 AM
Here Button should be inside quotes like this:
Please mark as answer if it helps.