How to create image gallery in c# with sql server Database

In this article, we will learn how to create an image gallery in c# using database sql server .Using of this article, we can also create a product gallery using database. You can also learn how to upload image and save in database using c#

Source Code:-

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html>

<html xmlns="">
<head runat="server">
    <title>How to create image gallery in c# with Database ||Neeraj Code Solutions</title>
     <link type="text/css" rel="stylesheet" href="js/style.css" />
    <script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
    <script type="text/javascript" src="js/jquery.easing.1.3.js"></script>
    <script type="text/javascript" src="js/jquery-galleryview-1.1/jquery.galleryview-1.1.js"></script>
    <script type="text/javascript" src="js/jquery-galleryview-1.1/jquery.timers-1.1.2.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
                panel_width: 800,
                panel_height: 400,
                frame_width: 100,
                frame_height: 100,
                nav_theme: 'custom'

    <form id="form1" runat="server">

    <div id="gallery" class="galleryview">
            <asp:GridView ID="gdgallery" runat="server" AutoGenerateColumns="false">
     <div class="panel">
                <img src='<%#Eval("image_path") %>' />
                 <div class="panel-overlay">
                    <h2><%# Eval("image_name")%></h2>                  
            <ul class="filmstrip">
            <asp:Repeater ID="rptthumb" runat="server">

            <li><img width="100" height="100" src='<%#Eval("image_path") %>'/></li>


Code behind(c#):-
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page

    protected void Page_Load(object sender, EventArgs e)
    protected void bindimage()
            SqlConnection con = new SqlConnection("Data Source=NEERAJ-PC\\NEERAJ;Initial Catalog=CodeSolution;Persist Security Info=True;User ID=sa; password=12345678");
            SqlCommand cmd = new SqlCommand("select * from tblImage", con);
            SqlDataAdapter da = new SqlDataAdapter(cmd);

            DataSet ds = new DataSet();
            gdgallery.DataSource = ds;
            rptthumb.DataSource = ds;
        catch (Exception ex)


You can also need to download this project for java script and css file 

How to create image gallery in c# with sql server Database How to create image gallery in c# with  sql server Database Reviewed by NEERAJ SRIVASTAVA on 9:50:00 PM Rating: 5

No comments:

Powered by Blogger.