Solved

ASP.net VB.net Set dynamically added TextBox to stretch accross screen

Posted on 2016-09-19
4
27 Views
Last Modified: 2016-09-19
Hi. I add a text box to my ASP.net panel using the following code. The CssClass used is in my Site.css file. The TextBox doesn't stretch across the width of the page as I would expect
                   Dim tb As New TextBox
                     tb.ID = "Control" 1
                     tb.CssClass = "xTextBoxHundredPercent"
                     Me.Panel_Controls.Controls.Add(tb)

Here is the class
    .xTextBoxHundredPercent {
     width: 100%;
 }
0
Comment
Question by:murbro
  • 2
  • 2
4 Comments
 
LVL 12

Expert Comment

by:Ramkisan Jagtap
Comment Utility
May be your panel has fixed width, so your child control will get the 100% width of its parent i.e. panel where you have added the button. If possible can you please post you full code here?
0
 

Author Comment

by:murbro
Comment Utility
Hi. I thought of that and tried the following code but it didn't work. See my Markup for the page below
Me.Form.Controls.Add(tb)

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

</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <asp:Panel ID="Panel_Controls" runat="server">
    </asp:Panel>
        <asp:Panel ID="Panel_Save" runat="server">
            <asp:Label ID="lblSaveError" runat="server" ForeColor="Red"></asp:Label>
            <asp:Label ID="lblSaveSuccess" runat="server" ForeColor="#006600"></asp:Label>
            <asp:Button ID="btnSave" runat="server" Text="Button" Width="100%" />
    </asp:Panel>
</asp:Content>
0
 
LVL 12

Accepted Solution

by:
Ramkisan Jagtap earned 500 total points
Comment Utility
Does other controls in panel_controls get 100% width?
Try to set width of panel to 100%
0
 

Author Closing Comment

by:murbro
Comment Utility
Thanks. I set the Panel to 100%
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

728 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now