Task is to write enter page that allows user to pick state specific page layout
ID: 3569457 • Letter: T
Question
Task is to write enter page that allows user to pick state specific page layout in CSS.
Currently I have
enter.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
public partial class enter : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void EnterButton_Click(object sender, EventArgs e)
{
HtmlLink link = new HtmlLink();
link.Href = CSSDropDownList.Text;
Label1.Text = CSSDropDownList.Text;
link.Attributes.Add("rel", "stylesheet");
link.Attributes.Add("type", "text/css");
Page.Header.Controls.Add(link);
}
protected void Page_Init(object sender, EventArgs e)
{
/*HtmlLink link = new HtmlLink();
link.Href = CSSDropDownList.Text;
link.Attributes.Add("rel", "stylesheet");
link.Attributes.Add("type", "text/css");
Page.Header.Controls.Add(link);*/
}
}
and enter.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="enter.aspx.cs" Inherits="enter" %>
<!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>Welcome</title>
</head>
<body>
<form id="form1" runat="server">
<div class="className">
<p>Choose your location: <br />
<asp:DropDownList ID="CSSDropDownList" runat="server"
CssClass="btn" AutoPostBack="True">
<asp:ListItem Value="Styles/Site-ar.css">Arkansas</asp:ListItem>
<asp:ListItem Value="Styles/Site-ok.css">Oklahoma</asp:ListItem>
</asp:DropDownList>
<asp:Button ID="EnterButton" runat="server" Text="Enter"
CssClass="btn" />
</p>
<p>
<asp:Label ID="Label1" runat="server"></asp:Label>
</p>
</div>
</form>
</body>
</html>
So far I can get the stylesheet changed to current page using this method but what I am looking for is to change stylesheet for all pages on the site using the selection that user makes at the entry page. What code should i use to accomplish this? If it is easier to use different master pages this can too work.
I am looking for code on how to do this.
Explanation / Answer
#include<stdio.h>
#define M 50
struct state {
char name[50];
long int population;
float literacyRate;
float income;
} st[M]; /* array of structure */
int main() {
int i, n, ml, mi, maximumLiteracyRate, maximumIncome;
float rate;
ml = mi = -1;
maximumLiteracyRate = maximumIncome = 0;
printf("Enter how many states:");
scanf("%d", &n);
for (i = 0; i < n; i++) {
printf(" Enter state %d details :", i);
printf(" Enter state name : ");
scanf("%s", &st[i].name);
printf(" Enter total population : ");
scanf("%ld", &st[i].population);
printf(" Enter total literary rate : ");
scanf("%f", &rate);
st[i].literacyRate = rate;
printf(" Enter total income : ");
scanf("%f", &st[i].income);
}
for (i = 0; i < n; i++) {
if (st[i].literacyRate >= maximumLiteracyRate) {
maximumLiteracyRate = st[i].literacyRate;
ml++;
}
if (st[i].income > maximumIncome) {
maximumIncome = st[i].income;
mi++;
}
}
printf(" State with highest literary rate :%s", st[ml].name);
printf(" State with highest income :%s", st[mi].name);
return (0);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.