Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

fonts enlarge on postback

Question posted by: BlackEye (Newbie) on July 23rd, 2008 08:43 AM
hi

everytime my .net page reloads after pressing a submit button, the fonts get enlarged. i dunno why this happens and how to check this

can anyone pls help me on this...
Frinavale's Avatar
Frinavale
Forum Leader
2,376 Posts
July 23rd, 2008
01:21 PM
#2

Re: fonts enlarge on postback
Are you using a style sheet?
If so, are you dynamically adding the style sheet to the page?

Reply
BlackEye's Avatar
BlackEye
Newbie
13 Posts
July 23rd, 2008
01:57 PM
#3

Re: fonts enlarge on postback
Quote:
Are you using a style sheet?
If so, are you dynamically adding the style sheet to the page?


thanx for replying

no i'm not using any style sheets. i dont need them yet.

its just a simple screen with labels, textboxes and a button.

the problem remains

Reply
Frinavale's Avatar
Frinavale
Forum Leader
2,376 Posts
July 23rd, 2008
06:10 PM
#4

Re: fonts enlarge on postback
Quote:
thanx for replying

no i'm not using any style sheets. i dont need them yet.

its just a simple screen with labels, textboxes and a button.

the problem remains


Try applying a style to your page to fix the problem.
If you don't know how to use CSS, w3c is a great resource to learn how to use it.

-Frinny

Reply
BlackEye's Avatar
BlackEye
Newbie
13 Posts
July 24th, 2008
06:05 AM
#5

Re: fonts enlarge on postback
Quote:
Try applying a style to your page to fix the problem.
If you don't know how to use CSS, w3c is a great resource to learn how to use it.

-Frinny


thanx for the suggestion...but i dont want to use style sheets right now and keep my application as simple as possible. i dont think such a problem should surface when style sheets are not in use. am i doing something wrong or is it possible that something could be wrong with my software?

Reply
Frinavale's Avatar
Frinavale
Forum Leader
2,376 Posts
July 24th, 2008
01:12 PM
#6

Re: fonts enlarge on postback
Quote:
everytime my .net page reloads after pressing a submit button, the fonts get enlarged.


There could be a number of reasons for this...
It could be your browser settings... it could be that you are displaying text in a Label in one area and in a Localize in another and your browser treats them differently.

To make sure that your page is displayed the same all the time you should use css...it's as simple as: <asp:Label id="myLabel" runat="server" style="font-size:12px"></asp:Label>

....Does your text keep enlarging every time you post back??

Reply
BlackEye's Avatar
BlackEye
Newbie
13 Posts
July 25th, 2008
08:26 AM
#7

Re: fonts enlarge on postback
Quote:
There could be a number of reasons for this...
It could be your browser settings... it could be that you are displaying text in a Label in one area and in a Localize in another and your browser treats them differently.

To make sure that your page is displayed the same all the time you should use css...it's as simple as: <asp:Label id="myLabel" runat="server" style="font-size:12px"></asp:Label>

....Does your text keep enlarging every time you post back??



The text size increases with the first postback. Then it remains large even after subsequent postbacks. The size does not increase further.

Reply
Frinavale's Avatar
Frinavale
Forum Leader
2,376 Posts
July 25th, 2008
01:09 PM
#8

Re: fonts enlarge on postback
Please post your ASP code responsible for displaying your text.

-Frinny

(PS. remember to use [code] tags when posting code snippets)

Reply
BlackEye's Avatar
BlackEye
Newbie
13 Posts
July 26th, 2008
11:40 AM
#9

Re: fonts enlarge on postback
Quote:
Please post your ASP code responsible for displaying your text.

-Frinny

(PS. remember to use code tags when posting code snippets)



if you are talking about the source code of the page, here it is:

Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="LoginScreen.aspx.cs" Inherits="_Default" %>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4.  
  5. <html xmlns="http://www.w3.org/1999/xhtml" >
  6. <head runat="server">
  7.     <title>Login Page</title>
  8. </head>
  9. <body bgcolor="#a6d7ff">
  10.     <form id="form1" runat="server">
  11.     <div>
  12.         &nbsp;&nbsp;
  13.         <asp:Label ID="WelcomeLabel" runat="server" Font-Bold="True" Font-Italic="True" Font-Names="Times New Roman"
  14.             Font-Size="X-Large" Font-Underline="True" ForeColor="Navy" Style="z-index: 100;
  15.             left: 343px; position: absolute; top: 43px" Text="Welcome to Login Screen" Width="444px"></asp:Label>
  16.         <asp:Label ID="UserNameLabel" runat="server" Font-Bold="True" Font-Size="Large" ForeColor="Navy"
  17.             Style="z-index: 101; left: 324px; position: absolute; top: 214px" Text="User Name:" Width="130px"></asp:Label>
  18.         <asp:Label ID="PasswordLabel" runat="server" Font-Bold="True" Font-Size="Large" ForeColor="Navy"
  19.             Style="z-index: 102; left: 336px; position: absolute; top: 274px" Text="Password:" Width="115px"></asp:Label>
  20.         <asp:TextBox ID="UserNameTextbox" runat="server" BackColor="LightCyan" Style="z-index: 103; left: 460px; position: absolute; top: 213px"></asp:TextBox>
  21.         <asp:TextBox ID="PasswordTextbox" runat="server" BackColor="LightCyan" Style="z-index: 104;
  22.             left: 460px; position: absolute; top: 273px" TextMode="Password"></asp:TextBox>
  23.         <asp:RequiredFieldValidator ID="UserNameRequiredFieldValidator" runat="server" ControlToValidate="UserNameTextbox"
  24.             ErrorMessage="Name is Required" ForeColor="DarkRed" Style="z-index: 105; left: 632px;
  25.             position: absolute; top: 215px" Width="118px">*</asp:RequiredFieldValidator>
  26.         <asp:RequiredFieldValidator ID="PasswordRequiredFieldValidator" runat="server" ControlToValidate="PasswordTextbox"
  27.             ErrorMessage="Password is Required" ForeColor="DarkRed" Style="z-index: 106;
  28.             left: 632px; position: absolute; top: 275px" Width="132px">*</asp:RequiredFieldValidator>
  29.         <asp:ValidationSummary ID="ValidationSummary1" runat="server" ForeColor="DarkRed"
  30.             HeaderText="Please take care of the following errors:" Style="z-index: 107; left: 351px;
  31.             position: absolute; top: 400px" Width="241px" />
  32.         <asp:Button ID="LoginButton" runat="server" BackColor="LightSteelBlue" Height="27px"
  33.             Style="z-index: 108; left: 460px; position: absolute; top: 327px" Text="Login"
  34.             Width="50px" OnClick="LoginButton_Click" />
  35.         <asp:Label ID="InvalidUserLabel" runat="server" ForeColor="DarkRed" Style="z-index: 110;
  36.             left: 324px; position: absolute; top: 368px"></asp:Label>
  37.  
  38.     </div>
  39.     </form>
  40. </body>
  41. </html>

Last edited by insertAlias : July 27th, 2008 at 10:46 PM. Reason: the code tag in frinny's quote was messing up the formatting.
Reply
Frinavale's Avatar
Frinavale
Forum Leader
2,376 Posts
July 28th, 2008
01:20 PM
#10

Re: fonts enlarge on postback
Try removing the Font-Names property from the labels and see if that makes a difference....

The only thing that comes to mind is that your validation is causing the change. The validators run some JavaScript that may be messing with your sizing/spacing on the page.

-Frinny

Reply
Reply
Not the answer you were looking for? Post your question . . .
190,474 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
Top .NET Forum Contributors