Hi,
I have a javascript for confirm that assigns a value to an asp hidden field
function ConfirmBox(msg) {
var x;
if (confirm(msg))
{
document.getElementById('<% =inpHide.ClientID %>').value = "1";
//return true;
}
else
{
document.getElementById('<% =inpHide.ClientID %>').value = "0";
//return false;
}
}
it will be called to from codebehind using this:
ClientScriptManager script = Page.ClientScript;
script.RegisterStartupScript(this.GetType(), "Error", "ConfirmBox('ADS Keymetrics General report already exists for this account for Q" + ADSImport.Upload.QTo + " " + ADSImport.Upload.YrTo + ". Do you want to overwrite the record?');", true);
int DiagResult = int.Parse(inpHide.Value);
if (DiagResult == 1)
{ ClientScript.RegisterClientScriptBlock(this.GetType(), "Error", "MessageBox('OK');", true); }
the confirm box won't pop-up and when i trace the code, it just passes by the RegisterStartupScript code and goes directly to
int DiagResult = int.Parse(inpHide.Value);
that's why it gives me an error: "Input string was not in a correct format." since the variable inpHide has a null value.
any help is greatly appreciated.
Thanks!