我通过循环 拼写的html字符串 将数据显示在控件Literal控件中,有谁知道如何对这些数据排序呀,要求按照价格,日期等排序,代码如下:
//单程
if (D == true)
{
IList<FlightInfo> fi = dif.getSearchList(this.HiddenFrom.Value, this.Hiddento.Value, this.fromDate.Text);
foreach (FlightInfo fl in fi)
{
//转机次数
int intall = Convert.ToInt32(fl.ChangeTime);
//有中转(样式)
if (intall > 0)
{
strb.Append("<li><div class=\"noli1\"><p class=\"p1_1 magt\" >单<br />程</p></div><div class=\"con\">");
intTrans = intTrans+1;
}
else //无中转
{
strb.Append("<li><div class=\"noli1\"><p class=\"p1_1\" >单<br />程</p></div><div class=\"con\">");
intNonStop = intNonStop+1;
}
foreach (Segment se in fl.segments)
{
//出发时间
string h = se.Flights[0].FromTime.Substring(0, 2);
string m = se.Flights[0].FromTime.Substring(2, 2);
//到达时间
string h1 = se.Flights[0].ToTime.Substring(0, 2);
string m1 = se.Flights[0].ToTime.Substring(2, 2);
//飞行时长
string[] du = se.Flights[0].Duration.Split(':');
string hdu = du[0];
string mdu = du[1];
strb.Append("<p><span class=\"noli2\"><a href=\"#\">" + Conn.getAirCompany()[se.Flights[0].AirCo] + "</a></span><span class=\"noli3\">" + h + ":" + m + " " + Conn.getAirPortName()[se.Flights[0].FromAirport] + "</span><span class=\"noli4\">" + se.Flights[0].EquipType + "</span><span class=\"noli5\">" + hdu + "小时</span></p><p><span class=\"noli2\"><strong><a href=\"#\">" + se.Flights[0].FlightNumber + "</a></strong></span><span class=\"noli3\">" + h1 + ":" + m + " " + Conn.getAirPortName()[se.Flights[0].ToAirport] + "</span><span class=\"noli4\">(大)</span><span class=\"noli5\">" + mdu + "分钟</span></p>");
if (intall > 0)
{
strb.Append("<p ><span class=\"noli7\">中转</span></p>");
intall = intall - 1;
}
}
if (intall > 1)
{
strb.Append("</div><div class=\"noli6 magt2\" ><p><span class=\"yahei\">¥</span><span class=\"jg2 orang \">" + fl.TotalFare + "</span></p><p>参考税<span class=\"yahei\">¥</span><span class=\"jg1\">" + fl.TotalTax + "</span></p><p><a href=\"#\"><img src=\"img/jp_yd.jpg\" width=\"80\" height=\"24\" /></a></p><p class=\"p3\"><a href=\"#\">更多相类似组合 <img src=\"img/jp_jt.jpg\" width=\"9\" height=\"8\" /></a></p></div></li>");
}
else
{
strb.Append("</div><div class=\"noli6\" ><p><span class=\"yahei\">¥</span><span class=\"jg2 orang \">" + fl.TotalFare + "</span></p><p>参考税<span class=\"yahei\">¥</span><span class=\"jg1\">" + fl.TotalTax + "</span></p><p><a href=\"#\"><img src=\"img/jp_yd.jpg\" width=\"80\" height=\"24\" /></a></p><p class=\"p3\"><a href=\"#\">更多相类似组合 <img src=\"img/jp_jt.jpg\" width=\"9\" height=\"8\" /></a></p></div></li>");
}
}//" + dif.SentOrder(fl) + "
this.Literal1.Text = strb.ToString();
//统计显示最低价
this.lbllowest.Text = fi[0].TotalFare;
}