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
This project will use the .NET framework to produce a set of materials to demonstrate the fundamental principles of .NET. Ideally it should demonstrate some of the principle
Create a script that presents a word guessing game. allow users to guess the word one letter at a time by entering a character in a form. start by assigning secret word to a
You will create a "TimeEntry" windows form application, user will input work hours for each day in a week (5 days) repeatedly, the program will record the user's time entrie
A company wants to see a printout of the gross payroll for each of its 7 departments. The output should be a list of the seven departments and the total gross payroll (rate
Design a web application using Visual Studio.NET 2012 - the difference between the files is the character ‘h' is missing in the position 120 in the uploaded file.
Write a program that prompts the user for a name, Social Security number, hourly pay rate, and number of hours worked. Display the information that was input by the user.
Write a console app that inserts 30 random letters into a List . Perform the following queries on the List and display your results: Use LINQ to sort the List in ascending or
Method Union creates a third set that is the set-theoretic union of two existing sets (i.e., an element of the third set's array is set to true if that element is true in ei