I have an application with a signin page. On the signin page, I load Javascript to get the UTCOffset from the clients browser.
When I use the standard asp.net button it works fine, when I try to use the radbutton. The button basically does not work. Not only just the javascript appear not to fire. It appears the page is not reloaded after the postback.
I was using the OnClientClickproperty, but that is not an option for the RadButton. I have tried OnClientClicked and OnClientClicking properties.
<script language="javascript" type="text/javascript">
//logic for this found http://forums.asp.net/t/1064203.aspx?PageIndex=2
function GetClientUtcOffset(frm) {
var d = new Date();
appendParam('uDate', d.getTimezoneOffset(), frm);
}
function appendParam(pName, pVal, tForm) {
var n = document.createElement('input');
n.setAttribute('name', pName);
n.setAttribute('type', 'hidden');
n.setAttribute('value', pVal);
var f = document.getElementById(tForm);
if (!f) {
// When using single Form page or not specifying Form
f = document.forms[0];
}
// append the new Element to the Form!
f.appendChild(n);
}
</script>
protected void Page_Load(object sender, EventArgs e)
{
btnSignin.OnClientClicked = "javascript:GetClientUtcOffset()";
}
protected void btnSignin_Click(object sender, EventArgs e)
{
String comparePassword = "";
String firstName = "";
Int32 userId = 0;
// Session["UtcOffsetMins"] = Server.HtmlDecode(Request["uDate"]).Split(',')[0];
// txtEmailAddress.Text = Server.HtmlDecode(Request["uDate"]).Split(',')[0];
txtEmailAddress.Text = "hello"; // even this does not work when I register JS on Page Load.
}
When I use the standard asp.net button it works fine, when I try to use the radbutton. The button basically does not work. Not only just the javascript appear not to fire. It appears the page is not reloaded after the postback.
I was using the OnClientClickproperty, but that is not an option for the RadButton. I have tried OnClientClicked and OnClientClicking properties.
<script language="javascript" type="text/javascript">
//logic for this found http://forums.asp.net/t/1064203.aspx?PageIndex=2
function GetClientUtcOffset(frm) {
var d = new Date();
appendParam('uDate', d.getTimezoneOffset(), frm);
}
function appendParam(pName, pVal, tForm) {
var n = document.createElement('input');
n.setAttribute('name', pName);
n.setAttribute('type', 'hidden');
n.setAttribute('value', pVal);
var f = document.getElementById(tForm);
if (!f) {
// When using single Form page or not specifying Form
f = document.forms[0];
}
// append the new Element to the Form!
f.appendChild(n);
}
</script>
protected void Page_Load(object sender, EventArgs e)
{
btnSignin.OnClientClicked = "javascript:GetClientUtcOffset()";
}
protected void btnSignin_Click(object sender, EventArgs e)
{
String comparePassword = "";
String firstName = "";
Int32 userId = 0;
// Session["UtcOffsetMins"] = Server.HtmlDecode(Request["uDate"]).Split(',')[0];
// txtEmailAddress.Text = Server.HtmlDecode(Request["uDate"]).Split(',')[0];
txtEmailAddress.Text = "hello"; // even this does not work when I register JS on Page Load.
}