0
我在製作HTML郵件模板。有人會在html中做一個佔位符嗎?我有一個我想解析的字符串數組,在某個列中。但正如從我的代碼預期,它只替換文本「row1」一次,所以我只得到第一個字符串項目。 那麼我該如何在html中添加一個字符串[]佔位符來爲數組中的每個字符串添加一個新行?那麼用什麼來取代「Row1」呢?html/C中未指定數量變量的佔位符#
的HTML代碼:
<table border="0" cellpadding="10" cellspacing="0" width="100%">
<tr>
<td class="leftColumnContent">
<p>Row1</p>
</td>
</tr>
</table>
的C#代碼的郵件我用盡:
StreamReader myreaderhtml = new StreamReader("htmlemail.html");
string[] lines = File.ReadAllLines("VUCresult.txt");
string htmlmailbody = myreaderhtml.ReadToEnd();
foreach (string s in lines)
{
htmlmailbody = htmlmailbody.Replace("Row2", namingConversion.GetADUserDisplayName(s));
}
for (int i = 0; i < lines.Length; i++)
{
htmlmailbody = htmlmailbody.Replace("Row1", lines[i]);
}
我有,我做到了。沒有任何工作適合我。所以只需要尋找一種逐行顯示整個數組的方法。 –
在EditorFor中使用HTML屬性: – Purushothaman