所以,我想用一个看起来像这样的代码隐藏函数设置我的 cssclass,但它不起作用,我在最终代码中只得到一个空字符串,我做错了什么?
ASP:
<td align="left" class="<% GetCssForUser("start") %>">
代码隐藏:
protected string GetCssForUser(string field)
{
string css = "";
switch(field)
{
case "start":
css = "start";
break;
case "end":
css = "end";
break;
case "course":
css = "course";
break;
case "group":
css = "group";
break;
case "teacher":
css = "teacher";
break;
case "room":
css = "room";
break;
case "plan":
css = "plan";
break;
}
if (User.ActiveRole == Teacher)
{
css += "Teacher";
}
else
{
css += "Student";
}
return css;
}