Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Controls (http://www.velocityreviews.com/forums/f63-asp-net-web-controls.html)
-   -   onclick for button and window.location.href (http://www.velocityreviews.com/forums/t781162-onclick-for-button-and-window-location-href.html)

Chuck 02-02-2010 07:15 PM

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>

Chuck 02-02-2010 07:42 PM

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.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57