Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, am tryng to create a login page as popup page using java script in asp.net i done it. but when i try to write the code behind for the submit buttoni cant how tocheck the data with the database

XML
<li><a href="#login-box" class="login-window">Login</a></li>
                                 <div id="login-box" class="login-popup">
                                    <a href="#" class="close"><img src="close_pop.png" class="btn_close" title="Close Window" alt="Close" /></a>
                                    <form method="post" class="signin" action="#">
                                        <fieldset class="textbox">
                                        <label class="username">
                                        <span>Username or email</span>
                                        <input id="username" name="username" value="" type="text" autocomplete="off" placeholder="Username"/>
                                        </label>
                                        <label class="password">
                                        <span>Password</span>
                                        <input id="password" name="password" value="" type="password" placeholder="Password"/>
                                        </label>

                                        <button class="submit button" type="button" >Sign in</button>
                                        <%--<p>
                                        <a class="forgot" href="#">Forgot your password?</a>
                                        </p>   --%>
                                        </fieldset>
                                    </form>
                                </div>


when i chick the login link popup will open and login page is diplaying but how to write the code behind for the page
Posted
Updated 24-Mar-14 20:42pm
v2

1.Is ASP.NET the code behind normally is linked with an existing ASPX control, so for a button you should use an ASPX button like in the next example:
<asp:Button ID="_cancelButton" runat="server" autopostback="False" Width="80px" Text="Cancel" OnClientClick='OnCancel();' />

2.For your case, I recommend to use ASP.NET AJAX Control Toolkit. You could see an example of using it in my next article: Advanced ASPX GridView Pagination and Data Entities[^]. The provided code, from my article, could be extended for a real application and I provided also guiding steps for doing this.
 
Share this answer
 
v2
use $.ajax() on Submit button click that will help you to Call method in code
like
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "Page.aspx/WebMethodName",
data: {userName: "testUser", password:"pass"},
dataType: "json",
success: successFunc,
error: errorFunc
});
 
Share this answer
 
Comments
Member 10227969 26-Mar-14 1:31am    
is it a web service method
Akshay_Randive 26-Mar-14 6:41am    
Not necessary it can be a simple "STATIC" method on any aspx.cs page
Member 10227969 26-Mar-14 8:20am    
i am new to .net try to learn so plz guide me
how to use this comment and how to get it in code behind..
where to write the code behind for this.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900