Design style elements in asp
Course:- DOT NET Programming
Reference No.:- EM13467

Assignment Help
Expertsmind Rated 4.9 / 5 based on 47215 reviews.
Review Site
Assignment Help >> DOT NET Programming

Add drop down lists for modifying the different style elements for the label element that displays the time.

We will do it via postback to the server. As it is for demonstration, you need to have only a few items in the drop-down lists.

For instance, I chose 4 background colors: Black, Red, Blue, Green; 4 foreground colors: White, lightPink, lightBlue, lightGreen; font-size: I used xx-small, x-small, small, medium, large, x-large, xx-large, smaller, larger

Note: I did not use lightRed because, it appears to be not supported: opinionatedgeek.com/DotNet/Tools/Colors/

For including a drop-down menu in your ASP form, from the ToolBox, choose Standard -> DropDownList. Once you have the DropDownList on the form, check the box Enable AutoPostBack; you can also do this by right clicking the DropDownList, select Properties and check that AutoPostBack is set to True.

Of course, you can also change the ID for the box, and any other properties you may want to change. You can add Items to a DropDownList by clicking Edit Items, or by going to Properties and selecting Items; it will say Collection, you can click on Collection, and it will open a box that will allow you to add items. You can add items, remove items, and even set the default value (when the page loads) have the Selected flag set to true.

Once you have added the DropDownLists (I will say try to do one DropDownList and see that it works to satisfaction, and then add the other lists), we need to specify the code for the actions in the code behind file. Remember that Page_Load will already have the necessary code to display the current time. In the ASP form, if we double click on any of the drop down lists, the necessary function for the drop down list (index changed function) will be created in the code behind file. Suppose the drop down list for changing the fonts is called list1, then we add this line to the code behind file for the index changed function for this list timeLabel.Style.Add("font-size", list1.SelectedValue); See that font-size is the property that we are changing, and list1.SelectedValue will give the value selected by the user. Similarly, we can modify the background color for timeLabel based on the value in list2 by: timeLabel.Style.Add("background-color", backgroundColorList.SelectedValue);

We can modify the foreground color for timeLabel based on the value in list3 by: timeLabel.Style.Add("color", fontColorList.SelectedValue);

Build your solution, and execute it, and see that it runs fine. Now, transfer the solution to the virtual machine, and see that the code runs fine. What to turn in: Turn in the URL on the web server to see that your code is working. Also turn in the entire folder created by Visual Studio for you (as a zip file), which also includes your aspx and code behind files.

Put your comment

Ask Question & Get Answers from Experts
Browse some more (DOT NET Programming) Materials
Please complete the following Programming Exercises listed in your book. All programs must be done according to these Programming Principles (properly formatted and commente
Develop a Loan application GUI Windows. Laid-back Loans is a company that offers flexible loan terms. All their loans are for 5 years (60 months) or less. The following infor
Design a Windows based application that should read or extract data from an outside source (preferably from other Microcontroller). Carry on a particular computation on the
Develop an ASP.NET web page that will allow the students to submit information about themselves, and the courses that they are taking on-line. The information will be stored
Demonstrate academic and professional literacy by collating theoretical and practical course material into a workable application through understanding concepts and their pr
Start by creating a folder called BegASPNET in the root of your C drive using Windows Explorer or My Computer. Inside the folder, create another folder called Site. You shou
Design an application that includes three arrays of type int. Allow the user to enter values into the first two. Write a method to store the product of the two arrays in the t
Using C#. make the interface for major and make suitable classes for each major. In student course instantiate IMajor major variable. In toString method call major.