Hello all .
I'm trying to assign a picture to a gridview column . i use the following statements , but i get a" Object reference not set to an instance of an object. "error .
How can i fix that ?
In my forms constructor i have this :
And in the form_load() i have this :
in my table , the image column contains an address to the image on my drive , and if there is , to show the picture , i created a imagecolumn from radGridViews Properties (collections) and named it image . thats what im trying to do
I'm trying to assign a picture to a gridview column . i use the following statements , but i get a" Object reference not set to an instance of an object. "error .
How can i fix that ?
In my forms constructor i have this :
((GridTableElement)
this
.radGridView_ClassInfo_ListHonarjoyan.GridElement).RowHeight = 80;
And in the form_load() i have this :
foreach
(GridViewRowInfo row
in
radGridView1.Rows)
{
row.Cells[
"picture"
].CellElement.ImageLayout = ImageLayout.Zoom;
row.Cells[
"picture"
].CellElement.ImageAlignment = ContentAlignment.MiddleCenter;
if
(row.Cells[
"image"
].Value ==
null
)
{
row.Cells[
"picture"
].CellElement.Image = Image.FromFile(
"img/1.jpg"
);
}
else
row.Cells[
"picture"
].CellElement.Image = Image.FromFile(row.Cells[
"image"
].Value.ToString());
//pictureBox1.Image = Image.FromFile(row.Cells["Picture"].Value.ToString());
}
in my table , the image column contains an address to the image on my drive , and if there is , to show the picture , i created a imagecolumn from radGridViews Properties (collections) and named it image . thats what im trying to do