Link to home
Start Free TrialLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

ASP.net Responsive text boxes not automatically fitting screens of mobilre devices

Hi

I am trying to build a web form in ASP.net 2015 that fits the screen of mobile devices. The first bit of code shows my markup for the page. The second bit of code shows the markup in my Site.Mobile.Master page. The  web page can  be seen at http://webappmobi.azurewebsites.net/
The text boxes aren't automatically fitting the size of different mobile device. What have I done wrong?

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Mobile.Master" CodeBehind="Default.aspx.vb" Inherits="Mobile1._Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <table>
        <tr>
            <td>
                <asp:Label ID="Label2" runat="server" Text="Username"></asp:Label>
            </td>
        </tr>
        <tr>
            <td>
                    <!--Responsive TextBox style is in Site.Mobile.Master-->
                    <asp:TextBox ID="txtUsername" runat="server" CssClass="responsive-textbox"></asp:TextBox>
            </td>
        </tr>

Open in new window


   <%@ Master Language="VB" AutoEventWireup="false" CodeBehind="Site.Mobile.master.vb" Inherits="Mobile1.Site_Mobile" %>

<%@ Register Src="~/ViewSwitcher.ascx" TagPrefix="friendlyUrls" TagName="ViewSwitcher" %>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <meta name="viewport" content="width=device-width" />
    <title></title>
    <!--Responsive TextBox style for text boxes to resize to the device-->
     <style type='text/css'>
    .responsive-textbox { width: 100%; }
  </style>


    <asp:ContentPlaceHolder runat="server" ID="HeadContent" />
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2>Lesedi Order System</h2>
        <asp:ContentPlaceHolder runat="server" ID="FeaturedContent" />
        <section class="content-wrapper main-content clear-fix">
            <asp:ContentPlaceHolder runat="server" ID="MainContent" />
        </section>
        <friendlyUrls:ViewSwitcher ID="ViewSwitcher1" runat="server" />
    </div>
    </form>
</body>
</html>

Open in new window

Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

There is nothing there that needs to fit anything so what are you talking about?  What are you using to test your code?  A phone?  Chrome in emulation mode?
Avatar of Murray Brown

ASKER

For example                     <asp:TextBox ID="txtUsername" runat="server" CssClass="responsive-textbox"></asp:TextBox>

uses the style
  <style type='text/css'>
    .responsive-textbox { width: 100%; }
I want this to fit thewidth of the screen. When I view it on a Windows phone and an android phone this doesn't happen
ASKER CERTIFIED SOLUTION
Avatar of Murray Brown
Murray Brown
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It was difficult for anyone to understand my question