Developer's point
  • Home
  • Business
    • Internet
    • Market
    • Stock
  • Parent Category
    • Child Category 1
      • Sub Child Category 1
      • Sub Child Category 2
      • Sub Child Category 3
    • Child Category 2
    • Child Category 3
    • Child Category 4
  • Featured
  • Health
    • Childcare
    • Doctors
  • Home
  • Business
    • Internet
    • Market
    • Stock
  • Downloads
    • Dvd
    • Games
    • Software
      • Office
  • Parent Category
    • Child Category 1
      • Sub Child Category 1
      • Sub Child Category 2
      • Sub Child Category 3
    • Child Category 2
    • Child Category 3
    • Child Category 4
  • Featured
  • Health
    • Childcare
    • Doctors
  • Uncategorized

Wednesday, 5 February 2014

How to Display Images from SQL Server Database in ASP .Net Grid View Control

 Davinder Singh     February 05, 2014     ASP .Net with C#     No comments   


Hello Friends,
                      In this article, I m going to explain how to store images and pictures on disk and their path in Databases with the help of File Upload Control and Also how to Display those Images in Asp.net Grid View Control. The Basic Concept behind This Technique is To Store the Image in a folder that resides in the WebSite Root Directory While the relative path of the images along with the file name is stored in SQL Server Database.

Their are few steps as given below:-


Step 1. First of all Create a database table that will store the image path. the figure below describes the structure of the table:- 


Step2.  Now I’ll add the File upload Control and Button to the .aspx page:-


Step3. Now Create the Images folder to the Website root Directory as follows... 


Step 4. Now Create a Connection String as:-


Step 5. Uploading and storing the image Files:-
                                                                         The Snippet below gets executed when the Upload Button is Clicked. It gets the uploaded image FileName and saves the image in images folder. And then inserts the Image FilePath into the Database. 



 C#


     The data is stored in the Database Table.

Step 6.  Display images in Grid view:-
                                                              Now, The next job is to display the images in Grid View Control . As you can see the below Grid View , I have added 2 bound fields which displays ID and File Name And a Image Field Displays the image based on the image path that comes from the database.


Step 7. The Snippet Given below is used to Display the images in the Grid view Control. As you will notice I m firing a simple select command and the returned datable is then bind to the GridView Control.

C#


The Grid View with images Is Shown as Below:-





  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Email ThisBlogThis!Share to XShare to Facebook
Newer Post Older Post Home

0 comments:

Post a Comment

Categories

  • ASP .Net with C# (2)
  • Computer Tricks (3)
  • Free Software (5)
  • IGNOU Solved Assignments (4)

Popular Posts

  • How to Apply Security to Admin Folder in a website using Admin Login
    In this article, I m going to explain how to Apply Security to Admin Folder in Website by using the default Asp .Net Security in Visual S...
  • (no title)
    How to Transfer files Wirelesssly between Your Android Phone and PC AirDroid   is one such popular and feature packed free   android ap...
  • Team Viewer 8.0.20202
    Team Viewer is Ready to use, right after Downloading! Download, Execute, and get Started!   Download: Click Here To Do...

Recent Posts

Unordered List

Pages

  • Home

Text Widget

Blog Archive

  • ▼  2014 (14)
    • ►  October (1)
    • ►  September (3)
    • ►  August (4)
    • ►  March (1)
    • ▼  February (5)
      • How to Apply Security to Admin Folder in a website...
      • How to Display Images from SQL Server Database in ...
      • Internet Download Manager (Activated)
      • Team Viewer 8.0.20202
      • To Check The Windows Activation

Search This Blog

About Me

Davinder Singh
View my complete profile
Powered By Blogger
Powered by Blogger.

How to Transfer files Wirelesssly between Your Android Phone and PC AirDroid   is one such popular and feature packed free   android ap...

About Me

Davinder Singh
View my complete profile

Sample Text

Copyright © Developer's point | Powered by Blogger
Design by Hardeep Asrani | Blogger Theme by NewBloggerThemes.com | Distributed By Gooyaabi Templates