Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I want to create a dataset and one of the elements in the dataset is to be an icon.

 

My doubt is how am I going to store an icon into a dataset so that datagrid could read it when i code :

 

datagrid1.datasource = dataset1.tables(0)

 

First row is icon, second row is name, third row is email address.

 

Please help me, thanks in advance.

George C.K. Low

  • Moderators
Posted
First row is icon, second row is name, third row is email address.

.

I think you meant First column...second column... Right?

 

Anyway, is the icon stored in the database, if so, in what data type?

Visit...Bassic Software
Posted

the dataset is direct from databases and the icon is manually added after da.fill(ds).

 

Summary:

1. da.selectcommand.commandtext = "SELECT * FROM tblList"

2. da.fill(ds)

3. Since the icon is no stored in the databases, i want to add it in this stage.

4. I want to add a column(first column) to have an icon.

George C.K. Low

Posted

Why dont you just store the name of the icon image file (or the complete path to the icon) in the dataset, and bind the location to an image inside the datagrid?

 

For example:

 

Your dataset contains a column named "icon_path", and you bind it to the following datagrid:

 

<ASP:Datagrid id="dgStuff" runat="server"...etc. etc.>

...

<ASP:TEMPLATECOLUMN>

<ITEMTEMPLATE>

<IMG src='<%# DataBinder.Eval(Container.DataItem,"icon_path") %>'>

</ITEMTEMPLATE>

</ASP:TEMPLATECOLUMN>

....

Posted

as i said, it is a windows application.

and, i dont' have the chance to edit the databases.

 

so what i can do now is to add the icon into the dataset (first column) after the data it is been retrieved.

George C.K. Low

Posted
as i said, it is a windows application.

and, i dont' have the chance to edit the databases.

 

so what i can do now is to add the icon into the dataset (first column) after the data it is been retrieved.

I am guessing you need a binaryreader/writer combination the construct an icon from a stream in the ItemDataBound Event of the data control. havent done this in .Net, but I have in delphi v7, so I know it is possible.

 

add a dummy column in your dataset, use the ItemDataBound Event to put the icon out there for that column.

Joe Mamma

Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized.

Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...