So, i want to set my cssclass with a codebehind function that looks like this, but it doesnt work, I only get an ampty string in my final code, what am I doing wrong?
Aspx:
<td align="left" class="<% GetCssForUser("start") %>">
CodeBehind:
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;
}
i think you messing syntax in this code
it’s use like this
i think this will help you