Friday, 29 April 2016

REMEDIATION SELECTION Software

REMEDIATION SELECTION Application

Hello every one today i introduce our new web-application for civil engineering. Remediation Selection is useful for building site.

A range of tools have been proposed to support decision making in contaminated land remediation.


Step One.
Step 2























Step Three
























Result Finally you get score of remediation technology .





















According to result civil engineer use that technology for construction site. This method is call remediation selection.  

How to remove shortcut virus

how to remove shortcut virus using cmd

Go to Start -> type -> cmd 
Right click on cmd and  click on run as administrator Go to your pen drive memory cards or mobile phone directory.
Type attrib -h -r -s /s /d e:*.* (Where e is the Drive Label )
And then press Enter.

Thank You

Tuesday, 26 April 2016

Simple horizontal Drop Down Menu CSS3

CSS3 Drop Down Menu 

Hello every one today i tell you how create simple drop down menu with simple animated effect using CSS3 properties.
 

Use Below Code between head tag of your html page.   

ul
{
  text-align: left;
  display: inline;
  margin: 0;
  padding: 15px 4px 17px 0;
  list-style: none;
  -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
  -moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
}
ul li
{
  font: bold 12px/18px sans-serif;
  display: inline-block;
  margin-right: -4px;
  position: relative;
  padding: 15px 20px;
  background: #fff;
  cursor: pointer;
  -webkit-transition: all 0.2s;
  -moz-transition: all 0.2s;
  -ms-transition: all 0.2s;
  -o-transition: all 0.2s;
  transition: all 0.2s;
}
ul li:hover
{
  background: #555;
  color: #fff;
}
ul li ul
{
  padding: 0;
  position: absolute;
  top: 48px;
  left: 0;
  width: 150px;
  -webkit-box-shadow: none;
  -moz-box-shadow: none;
  box-shadow: none;
  display: none;
  opacity: 0;
  visibility: hidden;
  -webkit-transiton: opacity 0.2s;
  -moz-transition: opacity 0.2s;
  -ms-transition: opacity 0.2s;
  -o-transition: opacity 0.2s;
  -transition: opacity 0.2s;
}
ul li ul li
{
  background: #555;
  display: block;
  color: #fff;
  text-shadow: 0 -1px 0 #000;
}
ul li ul li:hover { background: #666; }
ul li:hover ul {
  display: block;
  opacity: 1;
  visibility: visible;
}


Now following Code under body tag where you want horizontal menu
<ul>
<li>Home</li>
  <li>About</li>
  <li>
    Product
    <ul>
      <li>Web Design</li>
      <li>Web Development</li>
      <li>Illustrations</li>
    </ul>
  </li>
  <li>Blog</li>
  <li>Contact</li>
</ul>

Now run that page. Thank you.

Saturday, 23 April 2016

How to Fix "PageHandlerFactory-Integrated" bad module

Today i told you how to fix PageHandlerFactory-Integrated. This problem occurs when IIS is not install properly.


So just follow these steps

1. Run cmd (Run as Administrator ) 

2. type cd.. twice 

3. %windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe –i

Note this is work for windows 64 bit Only.


Friday, 22 April 2016

Risk Assessment Software Online. A Dynamic Risk Assessment System.

RISK ASSESSMENT Software

Hello every one today i introduce my developed software RBMOCS which help to calculate Risk Assessment of Soil. This is a web application for my client.

Step1


 Step2


Step3


Step4



Step5


Step6




Step7


Step8



Result

__________________________________






In this software you can download report in word and you can see in chart also. It is basically online application for Risk Assessment for Soil. 





















How to create connection class in c# , how to attach database from mdf file, How to attach database from Pendrive

Create connection class in c#(In App-Code Folder) 

How to attach database from mdf file 

How to attach database from Pendrive


First of all open your web.config file of your application
and write this following code

<?xml version="1.0"?>
<configuration>
  <connectionStrings>
   
   <!-- This code use when your database have password -- >
  <add name="CS"  connectionString="Data Source=VINEET-PC\SQLEXPRESS;Initial        Catalog=yourdbname;User ID=dbid;Password=dbpassword;Integrated Security=True;" providerName="System.Data.SqlClient"/>

<!-- This code use when your database with no password -- >
    <add name="CS" connectionString="Data Source=VINEET-PC\SQLEXPRESS;Initial Catalog=yourdbname;Integrated Security=True" providerName="System.Data.SqlClient"/>

<!-- This code use when your database access from other drive Suppose G is your drive -- >
     <add name="CS"  connectionString="Data Source=.\SQLExpress;AttachDbFilename=G:\youdabase.mdf;Integrated Security=True;User Instance=True;"providerName="System.Data.SqlClient" />


  </connectionStrings>
  <system.web>
    <customErrors mode="Off"/>
    <compilation debug="true" targetFramework="4.0"/>
    
  </system.web>
 
</configuration>

Now Create A class File in app_code folder using following code with name of Connection.cs

using System;
using System.Collections.Generic;
using System.Web;
using System.Data.SqlClient;
using System.Configuration;
using System.Configuration;
using System.Data;

/// <summary>
/// Summary description for Connection
/// </summary>
public class Connection
{
    public static SqlConnection con = new 
SqlConnection(ConfigurationManager.ConnectionStrings["CS"].ConnectionString) ; 
}



Now this connection file has been created
You can use your connection in any cs file like this

Connection.con.Open();
Connection.con.Close();
Connection.con

these above code is for attache database from other drive  for your application, so you use 3rd connectionstring for connection. 

Tuesday, 19 April 2016

How to show dynamic photo gallery in asp.net

How to show dynamic photo gallery in asp.net

In previous i told you how to save gallery in data base using asp.net (Previous Blog) . Now i will tell tell how to display that image in your website.

First add page in your website with name of album.aspx
and write following html code in this page.

CSS Code
<style type="text/css">
  .effect2
{
  position: relative;
  background-color:#99bf38;
  border:1px solid #ccc;
}
.effect2:before, .effect2:after
{
  z-index: -1;
  position: absolute;
  content: "";
  bottom: 15px;
  left: 10px;
  width: 50%;
  top: 80%;
  max-width:300px;
  background: #777;
  -webkit-box-shadow: 0 15px 10px #777;
  -moz-box-shadow: 0 15px 10px #777;
  box-shadow: 0 15px 10px #777;
  -webkit-transform: rotate(-3deg);
  -moz-transform: rotate(-3deg);
  -o-transform: rotate(-3deg);
  -ms-transform: rotate(-3deg);
  transform: rotate(-3deg);
}
.effect2:after
{
  -webkit-transform: rotate(3deg);
  -moz-transform: rotate(3deg);
  -o-transform: rotate(3deg);
  -ms-transform: rotate(3deg);
  transform: rotate(3deg);
  right: 10px;
  left: auto;
}

</style>


<div class="about-section">
    <div class="container">
    <h3> Gallery</h3>
    <div class="about-grids">
    <div class="col-md-4 about-grid">
              <h1>   Welcome</h1>
   
    </div>
    <div class="col-md-8 about-grid1">
    <h4>Gallery</h4>
    <asp:DataList ID="DataList1" runat="server" DataKeyField="Id" 
                    DataSourceID="SqlDataSource1" CellSpacing="4" RepeatColumns="3" 
                    RepeatDirection="Horizontal" onitemcommand="DataList1_ItemCommand" 
                    Width="227px">
                    <ItemTemplate>
                    <center>
                        <asp:Label ID="GroupIdLabel1" runat="server" Text='<%# Eval("GroupName") %>' Visible="False" /></center>
                         <div style="height:30px"> </div>
                         <div class="effect2" style="margin-left:10px">
                         <div style="top:10px">
                        <center>
                            <asp:ImageButton ID="ImageButton1" runat="server" Width="90%" Height="200" ImageUrl='<%# Eval("Image") %>' /> 
                        </center>
                     </div>
                     <div  style="width:217px; top:50px; text-align:center; line-height:22px">
                     <br />
                     <center>
                        <p style="font-size:13PX; color:#fff">  <%# Eval("GroupName")%> </p>
                     </center>
                    </div>
                    <div style="height:30px"> </div>
                    </div> 
                 </ItemTemplate>
                </asp:DataList>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:CS %>" 
                    SelectCommand="SELECT * FROM [GroupImage]"></asp:SqlDataSource>
    </div>
    <div class="clearfix"> </div>
    </div>
    </div>
</div>


Now add below code in .cs file (code behind)

 protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
    {

        Label lbl2 = (Label)e.Item.FindControl("GroupIdLabel1");
        Session["GroupImageName"] = lbl2.Text;
        Response.Redirect("Image.aspx");
    }

Now add Another page with name showimage.aspx

and add bellow html code in this file

Add Css File
<link rel="stylesheet" href="lightbox.css" type="text/css" media="screen" />
<script type="text/javascript" src="prototype.js"></script>
<script type="text/javascript" src="scriptaculous.js?load=effects"></script>
<script type="text/javascript" src="lightbox.js"></script>
<style type="text/css">
  .effect2
{
  position: relative;
  background-color:#99bf38;
  border:1px solid #ccc;
}
.effect2:before, .effect2:after
{
  z-index: -1;
  position: absolute;
  content: "";
  bottom: 15px;
  left: 10px;
  width: 50%;
  top: 80%;
  max-width:300px;
  background: #777;
  -webkit-box-shadow: 0 15px 10px #777;
  -moz-box-shadow: 0 15px 10px #777;
  box-shadow: 0 15px 10px #777;
  -webkit-transform: rotate(-3deg);
  -moz-transform: rotate(-3deg);
  -o-transform: rotate(-3deg);
  -ms-transform: rotate(-3deg);
  transform: rotate(-3deg);
}
.effect2:after
{
  -webkit-transform: rotate(3deg);
  -moz-transform: rotate(3deg);
  -o-transform: rotate(3deg);
  -ms-transform: rotate(3deg);
  transform: rotate(3deg);
  right: 10px;
  left: auto;
}

</style>
<div class="about-section">
    <div class="container">
    <h3> Gallery</h3>
    <div class="about-grids">
    <div class="col-md-4 about-grid">
                
   
    </div>
    <div class="col-md-8 about-grid1">
    <h4>Gallery</h4>
    <asp:DataList ID="DataList2" runat="server" DataSourceID="SqlDataSource2" 
                    RepeatColumns="4" RepeatDirection="Horizontal" Width="220px">
                    <ItemTemplate>
                    <center>
                        <asp:Label ID="GroupIdLabel1" runat="server" Text='<%# Eval("GroupName") %>' Visible="False" /></center>
                         <div style="height:30px"> </div>
                         <div class="effect2" style="margin-left:10px">
                         <div style="top:10px">
                        
                           <div class="frame1">
<center>
                        <a id="imageLink" href='<%# Eval("Image","~/{0}") %>' title='<%#Eval("Name") %>' rel="lightbox[Brussels]" runat="server" >
                        <asp:Image ID="Image1" ImageUrl='<%# Bind("Image", "~/{0}") %>' runat="server" Width="195" Height="160"  style="margin-top:6px" />
                            </a> 
                        </center>
                    
                     <p class="heading" style="font-size:12px; line-height:22px; color:#fff">   &nbsp;&nbsp;&nbsp;  <%# Eval("Name") %></p>
                          </center>
                            </div>
                        </center>
                     </div>
                  
                    <div style="height:30px"> </div>
                    </div> 
                 </ItemTemplate>
                </asp:DataList>
               <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:CS %>" 
                    SelectCommand="SELECT * FROM [Image] WHERE ([GroupName] = @GroupName) ORDER BY [Id]">
                    <SelectParameters>
                        <asp:SessionParameter Name="GroupName" SessionField="GroupImageName" 
                            Type="String" />
                    </SelectParameters>
                </asp:SqlDataSource>
    </div>
    <div class="clearfix"> </div>
    </div>
    </div>
</div>

In this file no code need to add code behind File (.cs) 

How to Create dynamic photo gallery in asp.net

Create dynamic photo gallery in asp.net using C#

Create Database in sql like this. There are two table 
1. Album Table
2. Image Table (which are related with album table)

Sql Script

CREATE TABLE [dbo].[GroupImage](
[Id] [int] IDENTITY(1,1) NOT NULL,
[GroupName] [varchar](80) NOT NULL,
[Image] [varchar](200) NULL,
 CONSTRAINT [PK__GroupIma__6EFCD4350F975522] PRIMARY KEY CLUSTERED 
(
[GroupName] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]


CREATE TABLE [dbo].[Image](
[Id] [int] IDENTITY(1,1) NOT NULL,
[GroupName] [varchar](80) NULL,
[Name] [varchar](50) NULL,
[Date] [varchar](30) NULL,
[Image] [varchar](200) NULL
) ON [PRIMARY]


Now add a folder with name of "GroupImage" in project folder.

Now add aspx page with name of GroupImage.aspx and add following script between head tag

  <script type="text/javascript">
        function fnConfirm() {
            if (confirm("The item will be deleted. Are you sure want to continue?") == true)
                return true;
            else
                return false;
        }
</script>
    <script type="text/javascript">
        function previewFile() {
            var preview = document.querySelector('#<%=Image1.ClientID %>');
            var file = document.querySelector('#<%=fulImage_Group.ClientID %>').files[0];
            var reader = new FileReader();

            reader.onloadend = function () {
                preview.src = reader.result;
            }

            if (file) {
                reader.readAsDataURL(file);
            } else {
                preview.src = "";
            }
        }
   </script>
  
Now add following code under body tag


 <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
  <section id="main" class="column">
  <article class="module width_full">
<header><h3>  Add Album</h3></header>
           <div class="row">
                <div class="col-lg-12">
<div class="module_content">

   <table class="xx">
        <tr>
            <td rowspan="2" 
                
                style="vertical-align: top;">
                <asp:GridView ID="GridView1" class="table table-striped table-bordered table-hover" runat="server" AutoGenerateColumns="False" 
                    OnSelectedIndexChanged="OnSelectedIndexChanged" 
                    onrowdeleting="GridView1_RowDeleting" Width="400px" Height="100%">
                    <Columns>
                        <asp:TemplateField HeaderText="Name">
                            <ItemTemplate>
                                <asp:Label ID="Name" runat="server" text='<%#Eval("GroupName")%>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Image">
                            <ItemTemplate>
                                <asp:Image ID="Image" runat="server" Height="50" ImageUrl='<%# "~/" +Eval("Image")%>'
                                    Width="50" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Action">
                            <ItemTemplate>
                                <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Select" ForeColor="Red">Select</asp:LinkButton>
                                <asp:LinkButton ID="LinkButton2" runat="server" CommandName="Delete" ForeColor="Red">Delete</asp:LinkButton>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </td>
            <td style=" font-size: 20px;">
              </td>
        </tr>
        <tr>
            <td style="vertical-align: top; width: 400px;">
                <table style=" width: 400px; line-height:40px; margin-left:40px">
                    <tr>
                        <td>
                            Folder Name</td>
                        <td>
                            <asp:TextBox ID="txtName_Group" runat="server"  Width="200px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Image</td>
                        <td>
                         <input ID="fulImage_Group" type="file" onchange="previewFile()"  
                    runat="server"  />
                           
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                                ControlToValidate="fulImage_Group" ErrorMessage="RequiredFieldValidator" 
                                ForeColor="Red" ValidationGroup="a">*</asp:RequiredFieldValidator>
                           
                        &nbsp;</td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;</td>
                        <td>
                            <asp:Button ID="btnSave_Group" runat="server" 
                                Text="Save" onclick="Upload" ValidationGroup="a" />
                            &nbsp;<asp:Button ID="btnEdit_Group" runat="server" onclick="btnEdit_Group_Click" 
                                Text="Edit" Visible="False" ValidationGroup="a" />
                            &nbsp;<asp:Button ID="btnCancel_Group" runat="server" 
                                onclick="btnCancel_Group_Click" Text="Cancel" Visible="False" />
                        </td>
                    </tr>
                </table>
                <br />
                <asp:Image ID="Image1" runat="server" Height="100px" Width="100px" />
            </td>
        </tr>
        <tr>
            <td class="style2">
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
    </table>
         </div>
        </div>
        </div>
        </article>
    </section>


Code behind (C#) code for cs file of this page
 add following namespace

using System.Data.SqlClient;
using System.Data;
using System.Configuration;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.IO;


after this use this code

    SqlCommand cmd;
    SqlDataAdapter da;
    DataSet ds;
    protected void Page_Load(object sender, EventArgs e)
    {

        gridViewBind();

    }
    private int CreateDirectory(string NewDirectory)
    {
        int c = 0;
        try
        {
            string savelocation = Server.MapPath("~/" + "GroupImage/");
            int directoryCount = System.IO.Directory.GetDirectories(savelocation).Length;
            savelocation = savelocation + NewDirectory;
            for (int i = 0; i < directoryCount; i++)
            {
                if (Directory.Exists(savelocation))
                {
                    c = 1;
                    break;
                }
            }
        }
        catch (IOException _err)
        {
            Response.Write(_err.Message);
        }
        return c;
    }
    void gridViewBind()
    {
        try
        {
            if (Connection.con.State != ConnectionState.Open)
                Connection.con.Open();
            da = new SqlDataAdapter("select * from GroupImage", Connection.con);
            ds = new DataSet();
            da.Fill(ds);
            GridView1.DataSource = ds;
            GridView1.DataBind();

        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
        finally
        {
            Connection.con.Close();
        }
    }
    protected void Upload(object sender, EventArgs e)
    {
        int dir = CreateDirectory(txtName_Group.Text);
        if (dir == 1)
        {
            Page.ClientScript.RegisterStartupScript(typeof(Page), "Error", "alert('This Name Folder Allready Exits')", true);
        }
        else
        {
            try
            {
                string imgPath = null, fileName = null;
                Directory.CreateDirectory(Server.MapPath("~/" + "GroupImage/" + txtName_Group.Text));
                if (fulImage_Group.PostedFile != null && fulImage_Group.PostedFile.FileName != "")
                {
                    fileName = fulImage_Group.PostedFile.FileName;
                    imgPath = "GroupImage/" + txtName_Group.Text + "/" + fileName;
                    string targetPath = Server.MapPath("~/" + imgPath);
                    Stream strm = fulImage_Group.PostedFile.InputStream;
                    var targetFile = targetPath;
                    GenerateThumbnails(strm, targetFile);
                }
                if (Connection.con.State != ConnectionState.Open)
                    Connection.con.Open();
                int x = 0;
                SqlCommand cmd = new SqlCommand("insert into GroupImage values('" + txtName_Group.Text + "','" + imgPath + "')", Connection.con);
                x = cmd.ExecuteNonQuery();
                if (x == 1)
                {
                    txtName_Group.Text = "";
                    gridViewBind();

                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(typeof(Page), "Error", "alert('Try Again !!!')", true);
                }
            }
            catch (Exception ex)
            {
                Page.ClientScript.RegisterStartupScript(typeof(Page), "Error", "alert('" + ex.Message + "')", true);
            }
            finally
            {
                Connection.con.Close();
            }
        }
    }
    protected void btnEdit_Group_Click(object sender, EventArgs e)
    {
        try
        {
            int x = 0;
            string imgPath = null, fileName = null;
            if (fulImage_Group.PostedFile != null && fulImage_Group.PostedFile.FileName != "")
            {
                fileName = fulImage_Group.PostedFile.FileName;
                imgPath = "GroupImage/" + txtName_Group.Text + "/" + fileName;
                string targetPath = Server.MapPath("~/" + imgPath);
                Stream strm = fulImage_Group.PostedFile.InputStream;
                var targetFile = targetPath;
                GenerateThumbnails(strm, targetFile);
            }
            if (Connection.con.State != ConnectionState.Open)
                Connection.con.Open();
            SqlCommand cmd = new SqlCommand("update GroupImage set Image='" + imgPath + "' where GroupName='" + txtName_Group.Text + "'", Connection.con);
            x = cmd.ExecuteNonQuery();
            if (x == 1)
            {
                txtName_Group.Text = "";
                txtName_Group.Enabled = true;
                Image1.ImageUrl = "";
                btnSave_Group.Visible = true;
                btnEdit_Group.Visible = false;
                btnCancel_Group.Visible = false;
                gridViewBind();

            }

        }
        catch (Exception ex)
        {
        }
        finally
        {
            Connection.con.Close();
        }
    }
    protected void btnCancel_Group_Click(object sender, EventArgs e)
    {
        txtName_Group.Text = "";
        txtName_Group.Enabled = true;
        btnCancel_Group.Visible = false;
        btnEdit_Group.Visible = false;
        btnSave_Group.Visible = true;
        Image1.ImageUrl = "";
    }
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        try
        {
            Label Name = GridView1.Rows[e.RowIndex].FindControl("Name") as Label;
            Connection.con.Open();
            string qry = "delete from GroupImage where GroupName='" + Name.Text + "'";
            cmd = new SqlCommand(qry, Connection.con);
            cmd.ExecuteNonQuery();
            string path = Server.MapPath("~/" + "GroupImage/" + Name.Text);
            Directory.Delete(path, true);
            gridViewBind();

        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
        finally
        {
            Connection.con.Close();
        }
    }
    private void GenerateThumbnails(Stream sourcePath, string targetPath)
    {
        using (var image = System.Drawing.Image.FromStream(sourcePath))
        {
            //var newWidth = (int)(image.Width * scaleFactor);
            //var newHeight = (int)(image.Height * scaleFactor);
            var newWidth = (int)(200);
            var newHeight = (int)(200);
            var thumbnailImg = new Bitmap(newWidth, newHeight);
            var thumbGraph = Graphics.FromImage(thumbnailImg);
            thumbGraph.CompositingQuality = CompositingQuality.HighQuality;
            thumbGraph.SmoothingMode = SmoothingMode.HighQuality;
            thumbGraph.InterpolationMode = InterpolationMode.HighQualityBicubic;
            var imageRectangle = new Rectangle(0, 0, newWidth, newHeight);
            thumbGraph.DrawImage(image, imageRectangle);
            thumbnailImg.Save(targetPath, image.RawFormat);
        }
    }
    protected void OnSelectedIndexChanged(object sender, EventArgs e)
    {
        GridViewRow row = GridView1.SelectedRow;
        txtName_Group.Text = (row.FindControl("Name") as Label).Text;
        Image1.ImageUrl = (row.FindControl("Image") as System.Web.UI.WebControls.Image).ImageUrl;
        txtName_Group.Enabled = false;
        btnSave_Group.Visible = false;
        btnEdit_Group.Visible = true;
        btnCancel_Group.Visible = true;

    }


Now Add New aspx file with name of Image.aspx

Add this html code in
 <script type="text/javascript">
        function previewFile() {
            var preview = document.querySelector('#<%=Image1.ClientID %>');
            var file = document.querySelector('#<%=FileUpload1.ClientID %>').files[0];
            var reader = new FileReader();

            reader.onloadend = function () {
                preview.src = reader.result;
            }

            if (file) {
                reader.readAsDataURL(file);
            } else {
                preview.src = "";
            }
        }
   </script>

<asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
  <section id="main" class="column">
  <article class="module width_full">
<header><h3>  Add Album</h3></header>
           <div class="row">
                <div class="col-lg-12">
<div class="module_content">
    <table class="style1">
        <tr>
            <td>
               
              
               
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td style="width: 500px;  vertical-align: top;">
                <asp:GridView ID="GridView1" class="table table-striped table-bordered table-hover" runat="server" AutoGenerateColumns="False" 
                    OnSelectedIndexChanged="OnSelectedIndexChanged" 
                    onrowdeleting="GridView1_RowDeleting">
                 <Columns>
                  <asp:templatefield headertext="Group Name">
                    <itemtemplate>
                        <asp:label id="GroupName" runat="server" text='<%#Eval("GroupName")%>'></asp:label>
                    </itemtemplate>
                    </asp:templatefield>
                    <asp:templatefield headertext="Image Name">
                    <itemtemplate>
                        <asp:label id="Name" runat="server" text='<%#Eval("Name")%>'></asp:label>
                    </itemtemplate>
                    </asp:templatefield>
                      <asp:templatefield headertext="Date">
                    <itemtemplate>
                        <asp:label id="Date" runat="server" text='<%#Eval("Date")%>'></asp:label>
                    </itemtemplate>
                    </asp:templatefield>
                    <asp:templatefield headertext="Image">
                    <itemtemplate>
                        <asp:Image ID="Image" runat="server" ImageUrl='<%#"~/" +Eval("Image")%>' Width="50" Height="50"/>
                     </itemtemplate>
                    </asp:templatefield>
                      <asp:TemplateField HeaderText="Action">
                            <ItemTemplate>
                                <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Select" ForeColor="Blue">Select</asp:LinkButton>
                                <asp:LinkButton ID="LinkButton2" runat="server" CommandName="Delete" ForeColor="Blue">Del</asp:LinkButton>
                                 <asp:label id="Id" runat="server" text='<%#Eval("Id")%>' Visible="false"></asp:label>
                                </ItemTemplate>
                        </asp:TemplateField>
                   </Columns>
                </asp:GridView>
            </td>
            <td style="width: 400px; vertical-align: top;">
                <table style="margin-left:30px">
                    <tr>
                        <td>
                            Group Name</td>
                        <td>
                            <asp:DropDownList ID="DropDownList1" runat="server" 
                                DataSourceID="SqlDataSource1" DataTextField="GroupName" 
                                DataValueField="GroupName" AutoPostBack="True" 
                                onselectedindexchanged="DropDownList1_SelectedIndexChanged" Width="200px" 
                                Height="25px">
                            </asp:DropDownList>
                            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:CS %>" 
                                SelectCommand="SELECT [GroupName] FROM [GroupImage] ORDER BY [GroupName]">
                            </asp:SqlDataSource>
                            <asp:HiddenField ID="hdfId" runat="server" />
                            <asp:HiddenField ID="hdfGroupName" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Name</td>
                        <td>
                            <asp:TextBox ID="TextBox1" runat="server" ClientIDMode="Static"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Date</td>
                        <td>
                            <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                            <asp:CalendarExtender ID="TextBox2_CalendarExtender" runat="server" Format="dd/MM/yyyy" 
                                Enabled="True" TargetControlID="TextBox2">
                            </asp:CalendarExtender>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Image</td>
                        <td>
                            <asp:FileUpload ID="FileUpload1" runat="server" onchange="previewFile()" />
                           
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                                ControlToValidate="FileUpload1" ErrorMessage="RequiredFieldValidator" 
                                ForeColor="Red" ValidationGroup="a">*</asp:RequiredFieldValidator>
                           
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;</td>
                        <td>
                            <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Save" 
                                ValidationGroup="a" />
                            <asp:Button ID="Button3" runat="server" onclick="Button3_Click" Text="Edit" 
                                Visible="False" ValidationGroup="a" />
                        &nbsp;<asp:Button ID="Button2" runat="server" onclick="Button2_Click" Text="Cancel" 
                                Visible="False" />
                        </td>
                    </tr>
                </table>
                <br />
                <asp:Image ID="Image1" runat="server" Height="100px" Width="100px" 
                    ImageAlign="Top" />
                    <br />
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
    </table>
    </div>
        </div>
        </div>
        </article>
    </section>


Now add this code in Image.aspx.cs file

using System.Data.SqlClient;
using System.Data;
using System.Drawing;
using System.Configuration;
using System.Drawing.Drawing2D;
using System.IO

SqlCommand cmd;
    SqlDataAdapter da;
    DataSet ds;
    string st;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
            binddata("select * from Image where GroupName='" + DropDownList1.SelectedItem + "' Order by [Id] Desc");

    }
    string check()
    {
        string imgPath = null, imgName = null, savelocation;
        imgName = FileUpload1.FileName;
        imgPath = "GroupImage/" + DropDownList1.SelectedItem + "/" + imgName;
        if ((FileUpload1.PostedFile != null) && (FileUpload1.PostedFile.ContentLength > 0))
        {
            savelocation = Server.MapPath("~/" + imgPath);
            int i = 1;
            while (i > 0)
            {
                if (File.Exists(savelocation))
                {
                    imgPath = "GroupImage/" + DropDownList1.SelectedItem + "/" + i + "-" + imgName;
                    savelocation = Server.MapPath("~/" + imgPath);
                    i++;
                    continue;
                }
                else
                {
                    i = 0;
                    break;
                }
            }
        }
        return imgPath;

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {
            string imgPath = check();
            string targetPath = Server.MapPath("~/" + imgPath);
            Stream strm = FileUpload1.PostedFile.InputStream;
            var targetFile = targetPath;
            Connection.con.Open();
            SqlCommand cmd = new SqlCommand("insert into Image values('" + DropDownList1.SelectedItem + "','" + TextBox1.Text + "','" + TextBox2.Text + "','" + imgPath + "')", Connection.con);
            SqlDataReader dr = cmd.ExecuteReader();
            GenerateThumbnails(strm, targetFile);
            dr.Close();
            binddata("select * from Image where GroupName='" + DropDownList1.SelectedItem + "'");
        }
        catch (Exception ex)
        {
        }
        finally
        {
            Connection.con.Close();
        }
    }
    private void GenerateThumbnails(Stream sourcePath, string targetPath)
    {
        using (var image = System.Drawing.Image.FromStream(sourcePath))
        {
            //var newWidth = (int)(image.Width * scaleFactor);
            //var newHeight = (int)(image.Height * scaleFactor);
            var newWidth = (int)(640);
            var newHeight = (int)(480);
            var thumbnailImg = new Bitmap(newWidth, newHeight);
            var thumbGraph = Graphics.FromImage(thumbnailImg);
            thumbGraph.CompositingQuality = CompositingQuality.HighQuality;
            thumbGraph.SmoothingMode = SmoothingMode.HighQuality;
            thumbGraph.InterpolationMode = InterpolationMode.HighQualityBicubic;
            var imageRectangle = new Rectangle(0, 0, newWidth, newHeight);
            thumbGraph.DrawImage(image, imageRectangle);
            thumbnailImg.Save(targetPath, image.RawFormat);
        }
    }
    void binddata(string st)
    {
        try
        {
            if (Connection.con.State != ConnectionState.Open)
                Connection.con.Open();
            da = new SqlDataAdapter(st, Connection.con);
            ds = new DataSet();
            da.Fill(ds);
            GridView1.DataSource = ds;
            GridView1.DataBind();

        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
        finally
        {
            Connection.con.Close();
        }
    }
    protected void OnSelectedIndexChanged(object sender, EventArgs e)
    {
        GridViewRow row = GridView1.SelectedRow;
        hdfGroupName.Value = (row.FindControl("GroupName") as Label).Text;
        hdfId.Value = (row.FindControl("Id") as Label).Text;
        TextBox1.Text = (row.FindControl("Name") as Label).Text;
        TextBox2.Text = (row.FindControl("Date") as Label).Text;
        Image1.ImageUrl = (row.FindControl("Image") as System.Web.UI.WebControls.Image).ImageUrl;
        Button1.Visible = false;
        Button2.Visible = true;
        Button3.Visible = true;
    }

    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        try
        {
            Label Id = GridView1.Rows[e.RowIndex].FindControl("Id") as Label;
            Label GroupName = GridView1.Rows[e.RowIndex].FindControl("GroupName") as Label;
            System.Web.UI.WebControls.Image ImgId = GridView1.Rows[e.RowIndex].FindControl("Image") as System.Web.UI.WebControls.Image;
            Connection.con.Open();
            string qry = "delete from Image where Id='" + Id.Text + "' and GroupName='" + GroupName.Text + "'";
            string path = Server.MapPath(ImgId.ImageUrl);
            System.IO.File.Delete(path);
            cmd = new SqlCommand(qry, Connection.con);
            cmd.ExecuteNonQuery();
            //GridView1.DataBind();
            binddata("select * from Image where GroupName='" + GroupName.Text + "'");

        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
        finally
        {
            Connection.con.Close();
        }
    }


    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        string st = "select * from Image where GroupName='" + DropDownList1.SelectedItem + "'";
        binddata(st);
    }
    protected void Button3_Click(object sender, EventArgs e)
    {
        try
        {
            int x = 0;
            string imgPath = check();
            string targetPath = Server.MapPath("~/" + imgPath);
            Stream strm = FileUpload1.PostedFile.InputStream;
            var targetFile = targetPath;
            Connection.con.Open();
            SqlCommand cmd = new SqlCommand("update Image set Image='" + imgPath + "',Name='" + TextBox1.Text + "',Date='" + TextBox2.Text + "' where GroupName='" + hdfGroupName.Value + "' and Id='" + hdfId.Value + "'", Connection.con);
            x = cmd.ExecuteNonQuery();
            GenerateThumbnails(strm, targetFile);
            if (x == 1)
            {
                TextBox1.Text = "";
                TextBox2.Text = "";
                Image1.ImageUrl = "";
                Button1.Visible = true;
                Button2.Visible = false;
                Button3.Visible = false;
            }
            binddata("select * from Image where GroupName='" + hdfGroupName.Value + "'");
        }
        catch (Exception ex)
        {
        }
        finally
        {
            Connection.con.Close();
        }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        TextBox1.Text = "";
        TextBox2.Text = "";
        Button2.Visible = false;
        Button3.Visible = false;
        Button1.Visible = true;
        Image1.ImageUrl = "";
    }


This is only for save gallery in database 
Now how to display this gallery in website like this

Next Page