I have a button
asp:Button ID="RejectButton" runat="server" CssClass="button" onclick="RejectButton_Click" Width="80px" Text="Reject" OnClientClick="javascript:return SelectValidatereject(RejectModalPanel)" />
This button is the target control for
<ajax:ModalPopupExtender runat="server" BackgroundCssClass="ModalBackground" TargetControlID="RejectButton" ID="TestModalPopupExtender" PopupControlID="RejectModalPanel" RepositionMode="RepositionOnWindowResize" PopupDragHandleControlID="RejectModalPanel"> </ajax:ModalPopupExtender>
The javascript function which runs onClientClick of RejectButton
function SelectValidatereject(RejectModalPanel) {
var checkObj = 0;
var targetcontrolid = document.getElementById("RejectWorkflowPopup");
for (i = 0; i < document.PdwfmsForm.elements.length; i++) {
if (document.PdwfmsForm.elements[i].name.indexOf("DeleteCheckBox") > -1) {
if (document.PdwfmsForm.elements[i].checked == true) {
var checkObj = 1;
}
}
}
if (checkObj == 0) {
alert("Select atleast one record");
var mpu = $find('<%= TestModalPopupExtender.ClientID %>');
mpu.dispose();
return false;
}
else {
return true;
}
}
As it can be seen, the function checks if a checkbox is checked and if its not, displays the alert box and is supposed to dispose of the Modal popup extender.
Everything works fine when the checkbox is checked. But when its not, the alert box displays fine; but once the function exits through return false, I get the error
"Microsoft JScript runtime error: Unable to get value of the property 'disabled': object is null or undefined" in this part
_onShow:function(a){if(!this.get_element().disabled){this.show();a.preventDefault();return false}}
I am also using an Update Panel... No idea why the error is appearing and I have been struggling for some time now. Hope you guys can help!

New Topic/Question
Reply




MultiQuote



|