在asp.net 中如何在.aspx.cs的文件里写代码来改变页面的颜色

2024-12-05 00:15:54
推荐回答(3个)
回答1:

改颜色:
.aspx :
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SessionTest.aspx.cs" Inherits="SessionTest" %>





无标题页













.aspx.cs 里
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Runtime.InteropServices;

public partial class SessionTest : System.Web.UI.Page
{
protected string bgcolor;

protected void Page_Load(object sender, EventArgs e)
{

}

protected void Button1_Click(object sender, EventArgs e)
{
bgcolor = "red";
}
}

回答2:

用js就可以了啊!干嘛还要通过服务器端啊

回答3:

bgcolor 吧