gpt4 book ai didi

c# - 无法获取 div_images 的内部内容,因为内容不是文字

转载 作者:太空狗 更新时间:2023-10-30 00:53:25 26 4
gpt4 key购买 nike

我收到以下错误。请在下面的代码中查看我做错了什么。

HTML :

    string ProductImages = string.Empty;
string str_query = string.Empty;
DataTable dt_Common = new DataTable();

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
bind_images();
}
}

代码:

 private void bind_images()
{
if (Request.QueryString["id"] != null)
{
str_query = "select top(5) image from tbl_product_images where productinfo_id='" + Request.QueryString["id"].ToString() + "'";
dt_Common = new CommonClass().bind_department(str_query);
if (dt_Common.Rows.Count> 0)
{
for (int i = 0; i < dt_Common.Rows.Count; i++)
{
div_images.InnerHtml += "<a class=\"activeborder\" data-image=" + dt_Common.Rows[i]["image"] + " data-zoom-image=" + dt_Common.Rows[i]["image"] + "><img src=" + dt_Common.Rows[i]["image"] + " /></a>"; // Getting error in this line.
}
}
}
else
{

}
}

我从前几天开始尝试,但没有得到解决方案。任何建议真的很感激。

最佳答案

我已经解决了这个问题:

StringBuilder _StrB = new StringBuilder();

if (Request.QueryString["id"] != null)
{
str_query = "select top(5) image from tbl_product_images where productinfo_id='" + Request.QueryString["id"].ToString() + "'";
dt_Common = new CommonClass().bind_department(str_query);
if (dt_Common.Rows.Count> 0)
{
for (int i = 0; i < dt_Common.Rows.Count; i++)
{
image.Src = dt_Common.Rows[i]["image"].ToString().Replace("~", "..");
_StrB.Append("<a id=" + i + " class=\"activeborder\" data-image=" + dt_Common.Rows[i]["image"].ToString() + " data-zoom-image=" + dt_Common.Rows[i]["image"].ToString() + "><img src=" + dt_Common.Rows[i]["image"].ToString() + " /></a>");
}

}
string AllHTMLImages = _StrB.ToString().Replace("~", "..");
div_images.InnerHtml = AllHTMLImages;
}
else
{

}

关于c# - 无法获取 div_images 的内部内容,因为内容不是文字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16522498/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com