hi all,

i am trying to display a xml file in a datagridview.

i am using windows application with C#.

say for example, i have a xml file like this,

<xml version="1.0" encoding="UTF-8">
<maincategory>
<cat1>
<title>Category1</title>
<link>http://www.w3schools.com</link>
<description>&lt;img src=&quot;http://static.ibnlive.com/pix/sitepix/09_2007/flames_ramsetu90.jpg&quot; alt=&quot;some description</description>
</cat1>
<cat2>
<title>Category2</title>
<link>http://www.ibnlive.com</link>
<description>&lt;img src=&quot;http://static.ibnlive.com/pix/sitepix/09_2007/rahul_gandhi_white90.jpg&quot;
some description</description>
</cat2>
</maincategory>

in the description i have a img tag containing a image from any site.
i have columns to display title,description.
i need to display the image along with the text in the same column description.

Adding an image column will display the image as a separate column. how can i display the image in the same column
along with the text?

Thanks in advance

Regards

Exelio

look you can make gridview cell to be a control, i.e PictureBox and then assign to this control the image path.
the scenario is, there is a base class you inherits from.
This was from MSDN but I am sorry I don't remember the link :s

hi all,

i am trying to display a xml file in a datagridview.

i am using windows application with C#.

say for example, i have a xml file like this,

<xml version="1.0" encoding="UTF-8">
<maincategory>
<cat1>
<title>Category1</title>
<link>http://www.w3schools.com</link>
<description>&lt;img src=&quot;http://static.ibnlive.com/pix/sitepix/09_2007/flames_ramsetu90.jpg&quot; alt=&quot;some description</description>
</cat1>
<cat2>
<title>Category2</title>
<link>http://www.ibnlive.com</link>
<description>&lt;img src=&quot;http://static.ibnlive.com/pix/sitepix/09_2007/rahul_gandhi_white90.jpg&quot;
some description</description>
</cat2>
</maincategory>

in the description i have a img tag containing a image from any site.
i have columns to display title,description.
i need to display the image along with the text in the same column description.

Adding an image column will display the image as a separate column. how can i display the image in the same column
along with the text?

Thanks in advance

Regards

Exelio

how can display image in a gridview control

i have the same problem , for example on of the columns of the Data grid is for something that is proposed to show a picture , for example imagine a mailbox which the attachment column in that is "Checked" for mails with an attachment file and "Unchecked" for others , I've tried to bind an image with that column but it didn't work

My idea is to create a 'User Control' that will have to fields a 'Label' and a 'PictureBox' and it will expose both as pulbic properties so you can then intanciate the 'User Control', set the Label's property as the image description and the PictureBox's(PictureBox's Image property) property as the actual image and then add the new User Control to the DataGrid's Cell.

The same idea but a diferent approche that I like better(better encapsulation ) is
Instead of exposing the PictureBox in the User Control as a public poperty expose the PictureBox's ImageLocation property as a public property.

P.S- I am going to try it to see exactly how it works.

Thanks,
Camilo

Hi,

My idea is to create a 'User Control' that will have to fields a 'Label' and a 'PictureBox' and it will expose both as pulbic properties so you can then intanciate the 'User Control', set the Label's property as the image description and the PictureBox's(PictureBox's Image property) property as the actual image and then add the new User Control to the DataGrid's Cell.

The same idea but a diferent approche that I like better(better encapsulation ) is
Instead of exposing the PictureBox in the User Control as a public poperty expose the PictureBox's ImageLocation property as a public property. And instead of expose the Label
expose the Label's Text property.

P.S- I am going to try it to see exactly how it works.

Thanks,
Camilo

hi all,

i am trying to display a xml file in a datagridview.

i am using windows application with C#.

say for example, i have a xml file like this,

<xml version="1.0" encoding="UTF-8">
<maincategory>
<cat1>
<title>Category1</title>
<link>http://www.w3schools.com</link>
<description>&lt;img src=&quot;http://static.ibnlive.com/pix/sitepi...tu90.jpg&quot; alt=&quot;some description</description>
</cat1>
<cat2>
<title>Category2</title>
<link>http://www.ibnlive.com</link>
<description>&lt;img src=&quot;http://static.ibnlive.com/pix/sitepi...te90.jpg&quot;
some description</description>
</cat2>
</maincategory>

in the description i have a img tag containing a image from any site.
i have columns to display title,description.
i need to display the image along with the text in the same column description.

Adding an image column will display the image as a separate column. how can i display the image in the same column
along with the text?

Thanks in advance
by sowmiya MCA

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.