【发布时间】:2019-05-27 12:16:54
【问题描述】:
我有一个电子邮件模板,我已经绑定了 1 个参数(this.OrderCode)并且它正在工作。所以现在我需要绑定另一个。
电子邮件模板如下,
string OrderTemplate="<p><%=this.OrderCode%></p><p><%=this.ReferredTo%></p>";
tempValues comes like below,
[0]this.OrderCode
[1]ODR5000
[2]this.ReferredTo
[3]Janez Smithson
使用下面的代码我需要显示以上两个值。这里只显示第一个值(ODR5000)
public string EmailTemplate(string OrderTemplate, params string[] tempValues)
{
string templatebody = string.Empty;
try
{
templatebody = OrderTemplate;
for (var i = 0; i < tempValues.Length; i++)
{
templatebody= templatebody.Replace("<%={0}%>".FormatWith(tempValues[i]), tempValues++);
}
}
catch (Exception ex)
{
throw ex;
Log4NetLogger.Log(ex);
}
return templatebody;
}
【问题讨论】:
标签: c# html asp.net asp.net-mvc