protected void ReadHtmlTable(string patientName, string startHour, string startMinute, int rowspan)
{
for(int i = 0; i <= tableAppointment.Rows.Count - 1; i++)
{
for(int j = 0; j <= tableAppointment.Rows[i].Cells.Count - 1; j++)
{
if(tableAppointment.Rows[i].Cells[j].InnerHtml.Trim() == startHour)
{
if(tableAppointment.Rows[i].Cells[j + 1].InnerHtml.Trim()== startMinute)
{
tableAppointment.Rows[i].Cells[j + 2].InnerText = patientName;
tableAppointment.Rows[i].Cells[j + 2].RowSpan = rowspan;
tableAppointment.Rows[i].Cells[j + 2].Style.Add("color", "green");
tableAppointment.Rows[i].Cells[j + 2].Style.Add("background", "green");
}
}
}
}
}
上面的代码是我的服务器端代码,它在OnSaveStateComplete(EventArgs e)事件上执行。我正在阅读我的HTML表格在C#中。当我检查它的第一个单元格第二个单元格文本时,它的结果如下所示:“\ r \ n \ t \ t \ t \ t \ t \ t \ t \ t \ t \ t \ t \ t \ t \ t \ t“。我使用修剪结束,但不工作。cells.InnerHtml not getting correct way
用InnerText.Trim()替换InnerHtml.Trim()。我想你在那里有“
”而不是“\ r \ n”。 –
以上cheebum是我的TD – John