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 VB.net Set dynamically added TextBox to stretch accross screen

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%;
 }
Avatar of Ramkisan Jagtap
Ramkisan Jagtap
Flag of Finland image

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?
Avatar of Murray Brown

ASKER

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>
ASKER CERTIFIED SOLUTION
Avatar of Ramkisan Jagtap
Ramkisan Jagtap
Flag of Finland 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
Thanks. I set the Panel to 100%