Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 在Datatable中添加图像标记_Asp.net_Datatable - Fatal编程技术网

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代码中获取图像,如果有问题,请更新您的问题。