Click here to Skip to main content
Rate this: bad
good
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 7-Oct-12 0:58am
sam9918948
Comments
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" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label runat="server" id="HelloWorldLabel">
</div>
</form>
</body>
</html>
 

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 asp.net" is not enough requirement. Since asp.net 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
good
Please Sign up or sign in to vote.

Solution 2

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:literal ID="Literal1" runat="server" Visible="true">
</asp:literal>
<asp:Timer ID="Timer1" runat="server" Interval="1000" OnTick="Timer1_Tick" >
</asp:Timer>
<asp:Label ID="Label1" runat="server" Text="">
<asp:Label>
<asp:Label ID="Label2" runat="server" Text="">
<asp:Label>
<asp:Label ID="Label3" runat="server" Text="">
<asp:Label>
<asp:Label ID="Label4" runat="server" Text="">
<asp:Label>
<asp:Label ID="Label5" runat="server" Text="">
<asp:Label>
<asp:Label ID="Label6" runat="server" Text="">
<asp:Label>
<asp:Label ID="Label7" runat="server" Text="">
<asp:Label>
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)
        {
            
            Literal1.Text="<h"+i+">"+"Hello"+"<h"+i+">"+"\n";
 
            if (i == 8)
            {
 
                i = 0;
            }
            else { i++; }
        }
    }
 
So,for every 1s you can find the font size changing
  Permalink  
Comments
sam9918 at 7-Oct-12 8:42am
   
thnks for the such a good solution...
Rate this: bad
good
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:
Hello!
Whereas
<span style="font-size:20px">Hello!</span>
Will print as:
Hello!
 
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:
  Permalink  
Comments
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 OriginalGriff 325
1 DamithSL 300
2 Sergey Alexandrovich Kryukov 289
3 CPallini 235
4 Maciej Los 215
0 OriginalGriff 5,455
1 DamithSL 4,422
2 Maciej Los 3,860
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,010


Advertise | Privacy | Mobile
Web03 | 2.8.141216.1 | Last Updated 19 Feb 2013
Copyright © CodeProject, 1999-2014
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