在GridView中动态着色图像

在GridView中动态着色图像

本文介绍了在GridView中动态着色图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好..

我想动态地在gridview中给图像着色..我将gridview与地块详细信息绑定..如果出售了地块,则特定的plotid图像应为红色..如何做到这一点..这是我的示例代码. .

Hi All..

I want to colour the image in gridview dynamically.. i bind the gridview with a plots details.. if the plot is sold then the particular plotid image should be in red colour.. how to do this.. here is my sample code..

public void Plots_colour(string image)
    {
        cmd = new SqlCommand("Select Plotid from Mas_PlotDetails where Sold_Status='1' and projid='PR001'", con);
        cmd.Connection.Open();
        SqlDataAdapter daa = new SqlDataAdapter(cmd);
        DataSet dss = new DataSet();
        daa.Fill(dss);

        for (int i = 0; i < dss.Tables[0].Rows.Count; i++)
        {
            foreach (GridView row in Gridview.Rows)
            {
               // row.FindControl("Image1"). = System.Drawing.Color.Red;

            }

        }
    }



我写了一个查询,其中已售出的地块已正确绑定到数据集中,现在我要为数据集的地块ID着色图像...



I wrote the query in which the sold plots are bindded correctly in dataset, now i want to color the image for the dataset plot id...

推荐答案

Image ib = ((Image)GridView1.Rows[j].FindControl("img"));
ib.BackColor=System.Drawing.Color.Red;


这篇关于在GridView中动态着色图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 16:59