I’m using an HtmlHelper where I give table data id’s based on day and month values which are retrieved. The problem is the id is not recognized in the format it’s in. '/' seems to not be picked up yet when I replace ‘/’ with ‘-‘ it works.
daysRow.AppendFormat("<td id='{0}/{1}'>{0}</td>", day, d1.Month.ToString());
Can anyone tell me how to format this?
The problem is not with C#, but rather, with your using a ‘/’ character in HTML. From the section of the HTML 4.0 spec on the id attribute:
The ‘/’ violates that rule, which is why you are seeing issues when using that, but not the ‘-‘ character.