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