我创建了奖品列表和语言选项。我想换一些奖品的照片。我的网站正在加载默认的土耳其语(如果选中) 其他语言,我将发送“&dl = en” QueryString。
这是我的代码;
using System.Web.UI.WebControls;
protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
{
var asd = e.Item.FindControl("Image1") as Image;
var asde = e.Item.FindControl("Image2") as Image;
var drw = e.Item.DataItem as DataRowView;
string a = drw["OdulID"].ToString();
var listColumns = new List<int>() { 121, 122, 123, 125, 128 };
var rowsToUpdate = new List<DataRowView>();
if (Request.QueryString["dl"] == "tr" || string.IsNullOrEmpty(Request.QueryString["dl"]))
asd.ImageUrl = System.Configuration.ConfigurationManager.AppSettings["webservis"] + @"resimGoster.aspx?Istek=Odul&ID=" + a + "&Resim=Resim";
else foreach (DataRowView row in drw.DataView)
{
if (lstColumns.Contains(Convert.ToInt32(row["OdulID"])))
rowsToUpdate.Add(row);
}
foreach (DataRowView row in rowsToUpdate)
asd.ImageUrl = System.Configuration.ConfigurationManager.AppSettings["webservis"] + @"resimGoster.aspx?Istek=Odul&ID=" + row["OdulID"] + "&Resim=Resim";
}
所有奖励图像均来自128.prize的图像。我该如何解决。我只想更改5个(121、122、123、125、128)ID奖品的图片。
答案 0 :(得分:0)
我认为更改“ + row [” OdulID“] +”,“ + row +”
foreach (DataRowView row in rowsToUpdate)
{
asd.ImageUrl = System.Configuration.ConfigurationManager.AppSettings["webservis"] + @"resimGoster.aspx?Istek=Odul&ID=" + row + "&Resim=Resim";
}