GridView 데이터 바인딩 각각의 Row 에 데이터 바인딩

    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {

        if (e.Row.RowType == DataControlRowType.DataRow)
        {

            System.Data.DataRowView drv = (System.Data.DataRowView)(e.Row.DataItem);
            int img_int = (int)drv["memo_read"];
            Control c = e.Row.FindControl("Image1");
            Control memoContent = e.Row.FindControl("LabelMemoContent");
            if (c != null)
            {
                if (img_int == 2)
                {
                    ((Image)c).ImageUrl = "img/img_16.jpg";
                }
                else {

                    ((Image)c).ImageUrl = "img/img_17.jpg";
                }              
            }

        }
    }

+ Recent posts