georgepatotk Posted July 8, 2004 Posted July 8, 2004 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. Quote George C.K. Low
Moderators Robby Posted July 8, 2004 Moderators Posted July 8, 2004 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? Quote Visit...Bassic Software
georgepatotk Posted July 8, 2004 Author Posted July 8, 2004 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. Quote George C.K. Low
Moderators Robby Posted July 8, 2004 Moderators Posted July 8, 2004 Web page or WinForm? I think you can use the ItemDataBound event for either. Quote Visit...Bassic Software
georgepatotk Posted July 8, 2004 Author Posted July 8, 2004 it is winform. Can u show me an example? please. Quote George C.K. Low
Rodenberg Posted July 9, 2004 Posted July 9, 2004 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> .... Quote
georgepatotk Posted July 9, 2004 Author Posted July 9, 2004 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. Quote George C.K. Low
Joe Mamma Posted July 9, 2004 Posted July 9, 2004 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. Quote 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.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.