![]() |
onclick for button and window.location.href
I want to open the FormsAuthentication Logon Page using javascript, not a
Response.Redirect. I can't get it to work. If I have the onclick Javascript read window.open, it works fine. If I use window.location or window.location.href it does not. <asp:Button ID="btnLogOut" runat="server" Text="Log Out" /> <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False">LinkButton</asp:LinkButton> btnLogOut.Attributes.Add("onclick","window.locatio n.href('"+ FormsAuthentication.LoginUrl + "?logout=true'); return false;"); LinkButton1.PostBackUrl=(FormsAuthentication.Login Url + "?logout=true"); The linkButton does work the regular button does not. <input type="submit" id="ctl00_ContentMain_btnLogOut" onclick="window.location.href('http://localhost/HRAuth/LogIn.aspx?logout=true'); return false;" value="Log Out" name="ctl00$ContentMain$btnLogOut"> <a href="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentMain$LinkBut ton1", "", false, "", "http://localhost/HRAuth/LogIn.aspx?logout=true", false, true))" id="ctl00_ContentMain_LinkButton1">LinkButton</a> |
RE: onclick for button and window.location.href
Never mind
bad js syntax window.location = not window.location() "Chuck" wrote: > I want to open the FormsAuthentication Logon Page using javascript, not a > Response.Redirect. > > I can't get it to work. If I have the onclick Javascript read window.open, > it works fine. If I use window.location or window.location.href it does not. > > > <asp:Button ID="btnLogOut" runat="server" Text="Log Out" /> > <asp:LinkButton ID="LinkButton1" runat="server" > CausesValidation="False">LinkButton</asp:LinkButton> > > > > > btnLogOut.Attributes.Add("onclick","window.locatio n.href('"+ > FormsAuthentication.LoginUrl + "?logout=true'); return false;"); > > LinkButton1.PostBackUrl=(FormsAuthentication.Login Url + "?logout=true"); > > The linkButton does work the regular button does not. > > > > <input type="submit" id="ctl00_ContentMain_btnLogOut" > onclick="window.location.href('http://localhost/HRAuth/LogIn.aspx?logout=true'); return false;" value="Log Out" name="ctl00$ContentMain$btnLogOut"> > > <a href="javascript:WebForm_DoPostBackWithOptions(new > WebForm_PostBackOptions("ctl00$ContentMain$LinkBut ton1", "", false, "", > "http://localhost/HRAuth/LogIn.aspx?logout=true", false, true))" > id="ctl00_ContentMain_LinkButton1">LinkButton</a> |
| All times are GMT. The time now is 04:36 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.