Asp.net 在Datatable中添加图像标记
我创建了一个数据表,我想在该数据表中添加图像标记。我的代码如下:-Asp.net 在Datatable中添加图像标记,asp.net,datatable,Asp.net,Datatable,我创建了一个数据表,我想在该数据表中添加图像标记。我的代码如下:- DataTable DTflight = new DataTable(); DataRow dr; DTflight.Columns.Add("AirLineName"); for (int i = 0; i < distinctFlights.Count-1; i++) { dr = DTflight.NewRow(); dr["AirLineName"]
DataTable DTflight = new DataTable();
DataRow dr;
DTflight.Columns.Add("AirLineName");
for (int i = 0; i < distinctFlights.Count-1; i++)
{
dr = DTflight.NewRow();
dr["AirLineName"] =distinctFlights[i].AirlinesImage;
DTflight.Rows.Add(dr);
}
DataTable DTflight=newdatatable();
数据行dr;
DTflight.Columns.Add(“AirLineName”);
对于(int i=0;i
我想在我的数据表中添加图像标记。如果可能的话,类似下面的内容
dr["AirLineName"] ='<img src='+distinctFlights[i].AirlinesImage;
dr[“AirLineName”]='
谢谢找到解决方案了吗
dr["AirLineName"] ="<img src=\"" + distinctFlights[i].AirlinesImage + "\" />";
dr[“AirLineName”]=“”;
我认为您不需要这样做。DataTable用于存储数据。您绑定到DataTable的任何控件都将具有HTML标记。请告诉我,我该如何做?您使用什么来显示数据?中继器?Grid?我正在使用GridView,但是Autogenerate列是真的,我很久没有使用GridView了。你就不能有像
这样的东西吗?(尽管您可能希望将datatable列重命名为AirlinesImage)。您应该尝试从GridView代码中获取图像,如果有问题,请更新您的问题。