Click here to Skip to main content
16,007,277 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Connection Issue While connecting to SqlServer 2000 from ASP.NET 2.0 Pin
nesaraja21-Dec-06 19:20
nesaraja21-Dec-06 19:20 
GeneralRe: Connection Issue While connecting to SqlServer 2000 from ASP.NET 2.0 Pin
RenuKhot21-Dec-06 19:55
RenuKhot21-Dec-06 19:55 
GeneralRe: Connection Issue While connecting to SqlServer 2000 from ASP.NET 2.0 Pin
nesaraja28-Dec-06 19:49
nesaraja28-Dec-06 19:49 
Questionunable to run copied asp code in local server Pin
madhumallidi21-Dec-06 13:01
madhumallidi21-Dec-06 13:01 
AnswerRe: unable to run copied asp code in local server Pin
ednrgc22-Dec-06 4:08
ednrgc22-Dec-06 4:08 
QuestionConfiguration failures Pin
whatever10121-Dec-06 10:38
whatever10121-Dec-06 10:38 
QuestionTriggering the Background color, font and other properties in ASP.Net Pin
Tina P21-Dec-06 10:21
Tina P21-Dec-06 10:21 
AnswerRe: Triggering the Background color, font and other properties in ASP.Net Pin
eggsovereasy21-Dec-06 10:53
eggsovereasy21-Dec-06 10:53 
This sounds like a homework problem (no CSS?)

Anyway try something like this:

runat=server in body tag with an ID

<body runat="server" id="TheBody">


Configure your DDL to AutoPostBack = true and wire up a SelectedIndexChanged handler:

<asp:DropDownList ID="ddlBG" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlBG_SelectedIndexChanged" Width="100px">
        <asp:ListItem>Pick one</asp:ListItem>
        <asp:ListItem>Red</asp:ListItem>
	<asp:ListItem>Blue</asp:ListItem>
	<asp:ListItem>Green</asp:ListItem>
<asp:DropDownList>


For some reason it turns "OnSelectedIndexChanged" into "removed"

Then set up your DDL with color choices and do something like this in the code behind:

protected void ddlBG_SelectedIndexChanged(object sender, EventArgs e)
{
	string color = string.Empty;

	switch (this.ddlBG.SelectedItem.Text)
	{
		case "Red":
			color = "#FF0000";
               		break;
		case "Blue":
			color = "#0000FF";
			break;
		case "Green":
			color = "#00FF00";
			break;
		default:
			color = "#dfdfdf";
			break;
	}

	this.TheBody.Attributes.Add("bgcolor", color);
}


This probably won't persist accross pages, but you said you have it figured out using session.
GeneralRe: Triggering the Background color, font and other properties in ASP.Net Pin
Tina P21-Dec-06 20:11
Tina P21-Dec-06 20:11 
GeneralRe: Triggering the Background color, font and other properties in ASP.Net Pin
Nimit Patel22-Dec-06 2:14
Nimit Patel22-Dec-06 2:14 
GeneralRe: Triggering the Background color, font and other properties in ASP.Net Pin
eggsovereasy22-Dec-06 8:51
eggsovereasy22-Dec-06 8:51 
GeneralRe: Triggering the Background color, font and other properties in ASP.Net Pin
Tina P22-Dec-06 10:39
Tina P22-Dec-06 10:39 
GeneralRe: Triggering the Background color, font and other properties in ASP.Net Pin
Tina P22-Dec-06 12:06
Tina P22-Dec-06 12:06 
NewsRe: Triggering the Background color, font and other properties in ASP.Net Pin
Tina P23-Dec-06 15:24
Tina P23-Dec-06 15:24 
QuestionGridview cross page data transfer Pin
srishree21-Dec-06 10:05
srishree21-Dec-06 10:05 
AnswerIf you want to use popup window for child gridview,this may help you Pin
kvPriya21-Dec-06 18:30
kvPriya21-Dec-06 18:30 
GeneralRe: If you want to use popup window for child gridview,this may help you Pin
srishree21-Dec-06 18:41
srishree21-Dec-06 18:41 
GeneralRe: If you want to use popup window for child gridview,this may help you Pin
kvPriya21-Dec-06 19:29
kvPriya21-Dec-06 19:29 
Questionflash +aspx Pin
keroed_edmond21-Dec-06 9:45
keroed_edmond21-Dec-06 9:45 
QuestionImageButton.Click event never gets fired! Pin
MY120121-Dec-06 9:08
MY120121-Dec-06 9:08 
AnswerRe: ImageButton.Click event never gets fired! Pin
eggsovereasy21-Dec-06 9:57
eggsovereasy21-Dec-06 9:57 
GeneralRe: ImageButton.Click event never gets fired! Pin
MY120121-Dec-06 10:06
MY120121-Dec-06 10:06 
GeneralRe: ImageButton.Click event never gets fired! Pin
eggsovereasy21-Dec-06 10:40
eggsovereasy21-Dec-06 10:40 
GeneralRe: ImageButton.Click event never gets fired! Pin
MY120121-Dec-06 20:23
MY120121-Dec-06 20:23 
QuestionDraw Table Pin
Blue_Boy21-Dec-06 4:47
Blue_Boy21-Dec-06 4:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.