Solved

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

Posted on 2016-08-14
4
84 Views
Last Modified: 2016-08-20
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

0
Comment
Question by:murbro
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 41755993
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?
0
 

Author Comment

by:murbro
ID: 41756152
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
0
 

Accepted Solution

by:
murbro earned 0 total points
ID: 41756190
I found that moving the text boxes out of the table made a difference
0
 

Author Closing Comment

by:murbro
ID: 41763509
It was difficult for anyone to understand my question
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question