Click here to Skip to main content
13,248,107 members (38,016 online)
Click here to Skip to main content
Articles » Web Development » ASP.NET » Samples » Downloads

Stats

65.6K views
2.5K downloads
45 bookmarked
Posted 24 Apr 2008

GridViewImages from DB in ASP.NET using C#

, 26 Jun 2009
GridViewImages from DB in ASP.NET using C#
DataGridImages
App_Data
Database.mdf
Database_log.LDF
DataGridImages in C# using Handler
App_Data
Database.mdf
Database_log.LDF
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Style="z-index: 100;
            left: 109px; position: absolute; top: 159px" Text="Save Image" />
        <asp:FileUpload ID="FileUpload1" runat="server" Style="z-index: 101; left: 2px; position: absolute;
            top: 97px" />
            
            
        <asp:GridView ID="GridView1" runat="server" AllowSorting="true" DataKeyNames="Img_Id" Style="z-index: 102; left: 403px; position: absolute;
            top: 52px" AutoGenerateColumns="false">
            <Columns>
            <asp:BoundField DataField="Img_Id"  />
            <asp:TemplateField> 
 <ItemTemplate> 
    <asp:Image ID="Image1" runat="server" ImageUrl='<%#    "Handler.ashx?id=" + Eval("Img_Id")  %>' /> 
 </ItemTemplate> 
</asp:TemplateField></Columns>
        </asp:GridView>
        <asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click" Style="z-index: 104;
            left: 241px; position: absolute; top: 261px">ShowImages</asp:LinkButton>
    
    </div>
    </form>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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

Share

About the Author

Naga Sridhar Madiraju
Web Developer Pasca Software Solutions
India India
No Biography provided

You may also be interested in...

Pro
Pro
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.171114.1 | Last Updated 26 Jun 2009
Article Copyright 2008 by Naga Sridhar Madiraju
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid