Search code examples
asp.netopenidpageload

Run a Button Code On Page Load


I Have folowing Button code and setting to take user to google for login using openid.Through this code i have to click on the button to take user to google.But I want to take user to google on page load also.Can anyone tell me how can i run the folowing command on page load event of login.aspx

<asp:Button ID="btnLoginToGoogle" Runat="server" Text="Login" OnCommand="OpenLogin_Click"  
                    CommandArgument="https://www.google.com/accounts/o8/id" 
                Font-Bold="True" Font-Italic="False" Width="162px" 
                onclick="btnLoginToGoogle_Click" Font-Names="Arial" Height="39px" BackColor="#4C8FFD" ForeColor="White" 

Solution

  • Try this

    document.getElementById("btnLoginToGoogle").click();