Click here to Skip to main content
11,641,668 members (60,632 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: ASP.NET
a program to display "Welcome to ASP.NET" 8 times in increasing font sizes using ASP.NET..

how can i do this thing..
Posted 6-Oct-12 23:58pm
sam9918 at 7-Oct-12 6:02am
i have tried solving like this...

HelloWorldLabel.Text = "Welcome to ASP.NET";
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="" >
<head runat="server">
<title>Untitled Page</title>
<form id="form1" runat="server">
<asp:Label runat="server" id="HelloWorldLabel">

but i am not able to increase the font of the label and that to only 8 times
Zoltán Zörgő at 7-Oct-12 7:48am
"using" is not enough requirement. Since is a web application framework, you make web application - a single web page in your case. So you can make it without any code just by writing html tags, or you can make it with javascript without any server side code. So how exactly your homework requirement looks like?
sam9918 at 7-Oct-12 8:46am
well the homework is finished..

but if you have any other solutions other than the 2 mentioned in the solutions then please do post it...
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

<asp:ScriptManager ID="ScriptManager1" runat="server">
In Code behind file you do this.

public partial class page1 : System.Web.UI.Page
       static int i = 1;
        protected void Page_Load(object sender, EventArgs e)
ViewState["key"] = Literal1.Text;
            Label1.Text = ViewState["key"].ToString();
Label2.Text = ViewState["key"].ToString();
Label3.Text = ViewState["key"].ToString();
Label4.Text = ViewState["key"].ToString();
Label5.Text = ViewState["key"].ToString();
Label6.Text = ViewState["key"].ToString();
Label7.Text = ViewState["key"].ToString();            
        protected void Timer1_Load(object sender, EventArgs e)
        protected void Timer1_Tick(object sender, EventArgs e)
            if (i == 8)
                i = 0;
            else { i++; }

So,for every 1s you can find the font size changing
sam9918 at 7-Oct-12 8:42am
thnks for the such a good solution...
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

A label has a font - so if you want to use labels, you have to use 8 of them in order to get 8 different sizes.

There are a number of ways to do this: I would use perhaps spans?
<span style="font-size:10px">Hello!</span>
Which will print as:
<span style="font-size:20px">Hello!</span>
Will print as:

However, if you are trying to produce a program to do this, you will probably need to write code in the codebehind to generate the spans. It's not difficult, but as it's your homework, I think you have enough clues to get started, don't you? Laugh | :laugh:
sam9918 at 7-Oct-12 6:20am
thnks for the suggestion... :)
OriginalGriff at 7-Oct-12 6:23am
You're welcome!
sam9918 at 7-Oct-12 6:24am
but still i am not able to do the same...

as i am using the for loop for doing the thing
but its not working..

or i have to use 8 spans and do my thing??
and make 1 span visible for a time and 2 span for the other time??
OriginalGriff at 7-Oct-12 6:38am
Web sites are static things: the data received by the browser is a string of HTML, which doesn't change once the page is loaded.
So if you need eight text sizes, you need to send 8 spans.
So your for loop in the codebehind needs to construct eight spans, and feed them to the web page. (It's not as difficult as it sounds - look in your lecture notes!)
sam9918 at 7-Oct-12 6:37am
well finally i have done... :) :D
OriginalGriff at 7-Oct-12 6:39am
Good for you!
What did you do in the end?
sam9918 at 7-Oct-12 8:41am
well i did the same as you said...
OriginalGriff at 7-Oct-12 9:30am
Good for you!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 DamithSL 253
1 Mika Wendelius 160
2 Sergey Alexandrovich Kryukov 134
3 OriginalGriff 110
4 Afzaal Ahmad Zeeshan 79
0 Mika Wendelius 460
1 OriginalGriff 265
2 DamithSL 258
3 CPallini 169
4 Afzaal Ahmad Zeeshan 149

Advertise | Privacy | Mobile
Web03 | 2.8.150731.1 | Last Updated 19 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100