Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6126367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:21:51+00:00 2026-05-23T16:21:51+00:00

Here is my effort for using JQuery mobile with asp.net webform. Below is the

  • 0

Here is my effort for using JQuery mobile with asp.net webform. Below is the code I have used in the Default.aspx page. It’s a very simple code

Below is the complete code of the aspx page.

  <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title> Login</title>
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.css" />
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
    <script type="text/javascript" src="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.js">
    </script>
</head>
<body>
    <form id="form1" runat="server">
  <!-- Start of first page -->
<div data-role="page" id="foo">
    <div data-role="header">
        <h1>Mobile Login</h1>
    </div><!-- /header -->
    <div data-role="content">   
        <table width="100%">
           <tr width="100%">
             <td width="30%" align="right" valign="middle">
               <asp:Literal ID="lblUserName" runat="server" Text="User Name"></asp:Literal>
             </td>
             <td width="50%">
               &nbsp;&nbsp;
                <input type="text" maxlength="20" id="UserName" style="width:50%;"  runat="server" />
             </td>
           </tr>
            <tr width="100%">
             <td width="50%"  align="right">
             <asp:Literal ID="Literal1" runat="server" Text="Password"></asp:Literal>
             </td>
             <td width="50%">
              &nbsp;&nbsp; <input type="text" maxlength="20" id="Password" style="width:50%;" runat="server" />
             </td>
           </tr>
            <tr width="100%">
             <td width="50%" align="right">

             </td>
             <td width="50%">
                <table width="100%">
                    <tr>
                      <td width="30%">
                        <asp:Button ID="btnLogin" runat="server" Text="Login"
                         OnClick="btnLogin_Click" />
                      </td>
                      <td width="30%">
                       <asp:Button ID="btnCancel" runat="server" Text="Cancel"  CssClass="ui-btn-active"
                         OnClick="btnCancel_Click" />
                      </td>
                      <td width="40%">

                      </td>
                    </tr>
                </table>
             </td>
           </tr>
        </table>        
    </div><!-- /content -->

    <div data-role="footer">
        <h4>
          @ All right reserved.
        </h4>
    </div><!-- /footer -->
</div><!-- /page -->

    </form>
</body>
</html>

Now on the server side

  protected void btnLogin_Click(object sender, EventArgs e)
{
    Response.Redirect("Home.aspx",true);

}
protected void btnCancel_Click(object sender, EventArgs e)
{
    UserName.Value = "";
    Password.Value = ""; 
}

but when I am clicking the login/cancel button nothing happen other than the Url is changed from

http://localhost:2278/Mobile/Default.aspx

to

http://localhost:2278/Mobile/Default.aspx#/Mobile/Default.aspx

What is wrong in my code? Can’t I access Server side functions from ASP.NET server controls in JQuery Mobile? I am aware that it can be done better in MVC but that’s not a option for me in this case.

Please help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:21:52+00:00Added an answer on May 23, 2026 at 4:21 pm

    This is because .net adds type="submit" to Button control by default. You need to set that to false and I would also set CausesValidation to false too, like this:

    <asp:Button ID="btnLogin" runat="server" Text="Login"
    OnClick="btnLogin_Click" CausesValidation="False" UseSubmitBehavior="False" />
    

    in all fairness however, I wouldn’t have used a server-side event just to navigate away on button click. You can achieve that with much easier way:

    <a href="Home.aspx" data-role="button">Login</a>
    

    ..that’s, of course, assuming you don’t have to do any other server-side operations before navigating away.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using NHibernate here with C#. I have a cache of nhibernate objects that
I have been using Unity for quite a while but I have always used
As of now I have done effort estimation based on experience and recently using
Because jQuery is a widely used and mature collaborative effort, I can't help but
The system I work on here was written before .net 2.0 and didn't have
Ok I'm using the jQuery Mobile Framework and adding the Experimental Date Picker but
I have asp.net mvc 2 application. since couple of days I was trying to
I am using the below javascript (jQuery) to toggle open two DIVs. The DIVs
Here's my asp code: <%@ Language = Python%> <% def main(): a = Request(btnSubmit)
The pasted below code i am using to create dropdown list and java script

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.