S
stephen
Hi,
I am binding the button.text dynamicall depending on the selection value of
the dropdownlist, at the same time I am trying to use a javascript to alert
users, but it does not fire. This is how I am doing it
In the page_load event I do this:
btnView.Attributes.Add("onclick", "return
TestValidator(btnView.Text);");
and in the page I do this:
function TestValidator(buttonValue)
{
if (buttonValue == "Get Name Values")
{
if (document.forms[0].FirstName.value != '' &&
document.forms[0].LastName.value != '')
{
var x = window.confirm("The Results will be according to LastName, do you
wish to proceed?")
return (x);
}
}
else if (buttonValue == "Get All Values")
{
if (document.forms[0].EmpID.value == '' || document.forms[0].Address.value
== '' || document.forms[0].Department.value == '')
{
alert("Requires EmpID, Address and Department")
}
}
}
Please Advice.
Stephen
[p.s: I apologize if I have posted in the wrong group]
I am binding the button.text dynamicall depending on the selection value of
the dropdownlist, at the same time I am trying to use a javascript to alert
users, but it does not fire. This is how I am doing it
In the page_load event I do this:
btnView.Attributes.Add("onclick", "return
TestValidator(btnView.Text);");
and in the page I do this:
function TestValidator(buttonValue)
{
if (buttonValue == "Get Name Values")
{
if (document.forms[0].FirstName.value != '' &&
document.forms[0].LastName.value != '')
{
var x = window.confirm("The Results will be according to LastName, do you
wish to proceed?")
return (x);
}
}
else if (buttonValue == "Get All Values")
{
if (document.forms[0].EmpID.value == '' || document.forms[0].Address.value
== '' || document.forms[0].Department.value == '')
{
alert("Requires EmpID, Address and Department")
}
}
}
Please Advice.
Stephen
[p.s: I apologize if I have posted in the wrong group]