Click here to Skip to main content
15,942,710 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
how to enlarge image within the gridview when i clik the image button..below is my gridview control with connected to database.

thank you for giving this time to answer my question..
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
            DataKeyNames="P_No" DataSourceID="SqlDataSource1"
            style="margin-left:115px" AllowPaging="True"
                <asp:BoundField DataField="P_No" HeaderText="P_No" ReadOnly="True"
                    SortExpression="P_No" ItemStyle-BackColor="#FFFF66" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" HeaderStyle-BackColor="#EAEA00" />
                <asp:BoundField DataField="Model" HeaderText="Model" SortExpression="Model" ItemStyle-BackColor="#FFFF66" HeaderStyle-BackColor="#EAEA00" />
                <asp:BoundField DataField="Price(Php)" HeaderText="Price(Php)"
                    SortExpression="Price(Php)" ItemStyle-BackColor="#FFFF66" HeaderStyle-BackColor="#EAEA00" />
                <asp:BoundField DataField="ImageFilename" HeaderText="ImageFilename"
                    SortExpression="ImageFilename" ItemStyle-BackColor="#FFFF66" HeaderStyle-BackColor="#EAEA00" />

            <asp:TemplateField HeaderText="Images" HeaderStyle-BackColor="#EAEA00" >
                   <!--<asp:Image ID="Image1" Height="50px" Width="60px" runat ="server" ImageUrl='<%#Eval("ImageFilename","~/Images/{0}") %>' /> -->
                   <asp:ImageButton ID="ImageButton1" runat="server" Height="50px" Width="60px" ImageUrl='<%#Eval("ImageFilename","~/Images/{0}") %>'  OnClientClick ="return abc();"  />


            <asp:SqlDataSource ID="SqlDataSource1" runat="server"
            ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString %>"
            SelectCommand="SELECT * FROM [DevelopTbl]"></asp:SqlDataSource>
Updated 14-Apr-13 6:41am
Sandeep Mewara 14-Apr-13 12:41pm    
Did you try anything so far?
brighteyes24 14-Apr-13 12:44pm    
actually this is working..but the problem is how to enlarge the image when i click it..give me idea pls..
vinodkumarnie 14-Apr-13 12:45pm    
How actually..? Can u explain more..?
brighteyes24 14-Apr-13 13:11pm    
i have the database record name DevelopTbl and the gridview for displaying the record..
in the gridview display the P_no,Model (of a product),the Price and the the images column it is an image display..but small is clickable because I use image button..the problem is i dont know how to enlarge it when i clik the image..i dont know what is codes of this..can you give me an idea?
i have also created Images folder where in I save the image in that folder.
sri senthil kumar 15-Apr-13 8:39am    
Instead of image button you can do with simple <img /> itself. onclick of it call a javascript to increase the image size alone (just increase the width n height of tht img using setAttribute or directly using style attributes). hope it helps u.

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