我是这样写的不行啊!!
cs protected void Page_Load(object sender, EventArgs e)
{
string bookid = Request.QueryString["id"].ToString();
if( bookid.Equals("1234567"))
{
this.shenghuo.Style.Add("backgroundColor", "#F2FFF8");
}
if( bookid.Equals("0000000"))
{
this.shenghuo.Style.Add("backgroundColor", "#ffffff");
}
}aspx <div id="shenghuo" runat="server" style="width:220px; height:45px; ">
</div>
应该怎么写?请高手给完整代码?谢谢了
cs protected void Page_Load(object sender, EventArgs e)
{
string bookid = Request.QueryString["id"].ToString();
if( bookid.Equals("1234567"))
{
this.shenghuo.Style.Add("backgroundColor", "#F2FFF8");
}
if( bookid.Equals("0000000"))
{
this.shenghuo.Style.Add("backgroundColor", "#ffffff");
}
}aspx <div id="shenghuo" runat="server" style="width:220px; height:45px; ">
</div>
应该怎么写?请高手给完整代码?谢谢了
string bookid = Request.QueryString["id"].ToString();
if( bookid.Equals("1234567"))
{
hfid.value = "#F2FFF8";
}
if( bookid.Equals("0000000"))
{
hfid.value = "#ffffff";
} 然后在你Onland事件里 用js 去控制控件的背景颜色啦
---------------------------------
shenghuo.Attributes.Add("style", " background-color:");
string bookid = Request.QueryString["id"].ToString();
if( bookid.Equals("1234567"))
{
//this.shenghuo.Style.Add("backgroundColor", "#F2FFF8");
shenghuo.Attributes.Add("style", " background-color:#F2FFF8");
}
if( bookid.Equals("0000000"))
{
//this.shenghuo.Style.Add("backgroundColor", "#ffffff");
shenghuo.Attributes.Add("style", " background-color:#ffffff"); }