Solved

Need Help formatting ASP form

Posted on 2011-03-07
7
191 Views
Last Modified: 2012-06-21
I am just starting out with MS Visual Studio 2010 trying to develop an asp form.  As shown in the code attached, I have 3 text boxes and multiple labels all on a single line.
I want to know how to align the text in the boxes to the RIGHT because they will use numbers.
Also, I included a separate label for each that has one character: *  and I set the property of these as RED. but when I run this code the * are the same color as the rest of the labels.
Any guidance would be helpful.

Thanks, Charlie
<%@ Page Title="Home Page" Language="vb" MasterPageFile="~/Site.Master" AutoEventWireup="false"
    CodeBehind="room_worksheet.aspx.vb" Inherits="room_worksheet._Default" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <h2>
        TESCOR, Inc. Room Worksheet</h2>
    <p>
        <asp:Table ID="Table1" runat="server" Width="897px">
        </asp:Table>
    </p>
    <p>
        <asp:Label ID="Label1" runat="server" Text="Exterior Dimensions: "></asp:Label>
        <asp:TextBox ID="txtExt_Width" runat="server" Width="80px"></asp:TextBox>
        <asp:Label ID="Label2" runat="server" Text="Feet Wide"></asp:Label>
        <asp:Label ID="Label3" runat="server" Text="*"></asp:Label>
        <asp:Label ID="Label4" runat="server" Text=" x "></asp:Label>
        <asp:TextBox ID="txtExt_Depth" runat="server" Width="80px"></asp:TextBox>
        <asp:Label ID="Label5" runat="server" Text="Feet Deep"></asp:Label>
        <asp:Label ID="Label6" runat="server" Text="*"></asp:Label>
        <asp:Label ID="Label7" runat="server" Text=" x "></asp:Label>
        <asp:TextBox ID="txtExt_Height" runat="server" Width="80px"></asp:TextBox>
        <asp:Label ID="Label8" runat="server" Text="Feet High"></asp:Label>
        <asp:Label ID="Label9" runat="server" Text="*"></asp:Label>
    </p>
</asp:Content>

Open in new window

0
Comment
Question by:charlieb01
  • 4
  • 3
7 Comments
 
LVL 8

Accepted Solution

by:
PagodNaUtak earned 500 total points
Comment Utility
try the below code:
<%@ Page Title="Home Page" Language="vb" MasterPageFile="~/Site.Master" AutoEventWireup="false"  
    CodeBehind="room_worksheet.aspx.vb" Inherits="room_worksheet._Default" %>  
  
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">  
</asp:Content>  
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">  
    <h2>  
        TESCOR, Inc. Room Worksheet</h2>  
    <p>  
        <asp:Table ID="Table1" runat="server" Width="897px">  
        </asp:Table>  
    </p>  
    <p>  
        <asp:Label ID="Label1" runat="server" Text="Exterior Dimensions: "></asp:Label>  
        <asp:TextBox ID="txtExt_Width" runat="server" Width="80px" Style="text-align:right;"></asp:TextBox>  
        <asp:Label ID="Label2" runat="server" Text="Feet Wide"></asp:Label>  
        <asp:Label ID="Label3" runat="server" style="color:red;" Text="*"></asp:Label>  
        <asp:Label ID="Label4" runat="server" Text=" x "></asp:Label>  
        <asp:TextBox ID="txtExt_Depth" runat="server" Width="80px"  Style="text-align:right;"></asp:TextBox>  
        <asp:Label ID="Label5" runat="server" Text="Feet Deep"></asp:Label>  
        <asp:Label ID="Label6" runat="server" style="color:red;" Text="*"></asp:Label>  
        <asp:Label ID="Label7" runat="server" Text=" x "></asp:Label>  
        <asp:TextBox ID="txtExt_Height" runat="server" Width="80px"  Style="text-align:right;"></asp:TextBox>  
        <asp:Label ID="Label8" runat="server" Text="Feet High"></asp:Label>  
        <asp:Label ID="Label9" runat="server" style="color:red;" Text="*"></asp:Label>  
    </p>  
</asp:Content>

Open in new window

0
 

Author Comment

by:charlieb01
Comment Utility
OK, thanks, That worked.
But, before I accept this solution can you tell me if the only way to do this is by hand coding or can this be done by setting properties the way most stuff in Visual Studio is set?
0
 
LVL 8

Expert Comment

by:PagodNaUtak
Comment Utility
You can change the forecolor of a label by perfroming the code below:

click on the label then right click select properties. On the properties toolbar select forecolor then select your desired color on the list.

But for changing the text alignment is done only in code.




0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 8

Expert Comment

by:PagodNaUtak
Comment Utility
You can change the forecolor of a label by performing the steps below:


•click on the label then right click select properties. On the properties toolbar select forecolor then select your desired color on the list.



But for changing the text alignment is done only in code.

0
 

Author Comment

by:charlieb01
Comment Utility
I have tried setting the forecolor property of a label as you describe and it doesn't work. I would expect that following your directions I would see the code change and it does not.
0
 
LVL 8

Expert Comment

by:PagodNaUtak
Comment Utility
0
 

Author Comment

by:charlieb01
Comment Utility
I read the article and it says the same thing you described regarding the forecolor property. My only point is, it didn't work like that for me. Changing the forecolor property of a label (even a new on I added as a test) did not change the code nor did it change the output when I ran the page.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

771 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

15 Experts available now in Live!

Get 1:1 Help Now