Click here to Skip to main content
16,018,294 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a data grid view i want to display images in grid view from data base

if any one no pls help me

pls forward sample project on my email id


[email removed]@gmail.com


thank you
Posted
Updated 20-Aug-11 1:16am
v2
Comments
walterhevedeich 20-Aug-11 7:18am    
I have removed your email address. Never post your email unless you want to invite spam.
thatraja 20-Aug-11 10:24am    
Don't do that man :mad: I'm collecting all mails to sell to spammers after a big bunch :D
walterhevedeich 20-Aug-11 21:12pm    
You can always look at v1. :)
thatraja 21-Aug-11 1:00am    
But I'm a lazy :D

Use this code in ItemTemplate tag.
the url ,description are fetch from database.as
C#
string selectSQL = "SELECT description,url FROM imgTable";
        SqlConnection cnn = new SqlConnection(connectionString);
        SqlDataAdapter adp = new SqlDataAdapter(selectSQL, cnn);
        DataSet ds = new DataSet();
        adp.Fill(ds);
        dgv1.DataSource = ds;
        dgv1.DataBind();


C#
<itemtemplate>
                <asp:imagebutton id="Image1" runat="server" height="120px" xmlns:asp="#unknown">
                    ImageUrl=' <%#Eval("url")%>' Width="180px" CommandName="select" CommandArgument='<%#Eval("url") %>'/>
                <br />
                Description : <%#Eval("Description")%> 
               
            </asp:imagebutton></itemtemplate>
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900