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

Assignment Help
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
Write down C# program which inputs radius of a circle and outputs its area. Permit the user to repeat computations as often as desired.
Write a two- to four-page paper describing how you would change or enhance your site if you "knew then what you know now". Be sure to include interaction with Spry Validatio
Calculate and display average grade for the class. Clearly identify which methods you choose to include in the project (filling arrays from textboxes, populating the Listbox
Determine the price of the shirts from the radio buttons and check boxes for the monogram and pockets. Multiply the quantity by the price to determine the extended price, an
Demonstrate academic and professional literacy by collating theoretical and practical course material into a workable application through understanding concepts and their pr
Using Microsoft Visual Studio, write an application to find the area and perimeter of a rectangle for the given input values of Length and Width in different measurement uni
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
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