Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2016-09-19
4
Medium Priority
?
48 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:Murray Brown
  • 2
  • 2
4 Comments
 
LVL 12

Expert Comment

by:Ramkisan Jagtap
ID: 41805902
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:Murray Brown
ID: 41805905
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 2000 total points
ID: 41805910
Does other controls in panel_controls get 100% width?
Try to set width of panel to 100%
0
 

Author Closing Comment

by:Murray Brown
ID: 41805932
Thanks. I set the Panel to 100%
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

972 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