PDA

View Full Version : [CLOSED] BackColor,ForeColor not work



hdsoso
Aug 14, 2014, 1:14 PM
i want to change the default radiobutton's text forecolor and backcolor,my test case is below , but not change anything.


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="info.hdsoso.com.test.WebForm2" %>

<%@ Import Namespace="System.Drawing" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
LoadData();
}
}

private void LoadData()
{
rg.Items.Clear();
var radio = new Radio
{
FieldLabel = "radiolabel",
LabelAlign = LabelAlign.Right,
InputValue = "1",
CssClass = "hoverme",

};
radio.BackColor = Color.DeepSkyBlue;
radio.ForeColor = Color.White;
var radio1 = new Radio
{
FieldLabel = "radiolabel",
LabelAlign = LabelAlign.Right,
InputValue = "1",
CssClass = "hoverme",

};
rg.Items.Add(radio);
rg.Items.Add(radio1);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager runat="server"></ext:ResourceManager>
<ext:RadioGroup runat="server" ID="rg"></ext:RadioGroup>
</form>
</body>
</html>

Vladimir
Aug 14, 2014, 3:02 PM
It is ASP.NET properties, they are not supported in Ext.Net widgets
Use Ext.Net properties to change CSS rules (Cls, StyleSpec and etc)

geoffrey.mcgill
Jan 15, 2015, 3:22 AM
Related discussion:

http://forums.ext.net/showthread.php?51061-Label-properties-ForeColor-and-BackColor-on-codebehind