Hello,
I am using ASP.Net C#. I am trying to create a datalist on asp.net page. I want 3 columns: Image, Title and Description.
My problem is I have tons of images in single directory based on quater system. I want this datalist in such a way that it should automatically load all the images in first column one by one based on current quater and second and third column empty, so that user can add title and description to image.
after adding description and title to all images I will save this information into new table.
Any Idea? any help will be appreciated.
Thanks
4 2314
'try this code list out all image from Directory, U can add these File names in Datatable and thn Add tht DataTable as DataSource to DataGrid or Data List
' Check whether Path is Exist or not
If Not Directory.Exists(sPath) Then Exit Sub
Try
Dim di As New DirectoryInfo(sPath)
Dim aryFi As System.IO.FileInfo() = di.GetFiles("*.jpg")
Dim fi As System.IO.FileInfo
For Each fi In aryFi
sFilename = fi.Name
Next
Catch ex As Exception
End Try
Hey Kunal,
Can u plz provide smthing Asp.net C# and elaborate more.
Thanks
'try this code list out all image from Directory, U can add these File names in Datatable and thn Add tht DataTable as DataSource to DataGrid or Data List
' Check whether Path is Exist or not
If Not Directory.Exists(sPath) Then Exit Sub
Try
Dim di As New DirectoryInfo(sPath)
Dim aryFi As System.IO.FileInfo() = di.GetFiles("*.jpg")
Dim fi As System.IO.FileInfo
For Each fi In aryFi
sFilename = fi.Name
Next
Catch ex As Exception
End Try
Hey Kunal,
Can u plz provide smthing Asp.net C# and elaborate more.
Thanks
Try this code converter tool.
Nathan
Hello,
This is what i tried, I gave me result in Label
Blue hills.jpg
Sunset.jpg
Water lilies.jpg
Winter.jpg
But what shd i do next . I need to show all these images in first column of gridview one by and than second and third column with empty textboxes. -
-
using System.IO;
-
-
public partial class Images: System.Web.UI.Page
-
{
-
string strDriveLetter = "C:/";
-
string strDefaultPath = "Documents and Settings/All Users/Documents/My Pictures/Sample Pictures";
-
protected void Page_Load(object sender, EventArgs e)
-
{
-
string strPath;
-
// check if the query string variable "strPath" has a value
-
// if it does, we are navigating a folder that is under the root folder
-
// if it does not, we start at the root folder by default
-
if (Request.QueryString["strPath"] != null)
-
{
-
strPath = Request.QueryString["strPath"];
-
}
-
else
-
{
-
strPath = strDefaultPath;
-
}
-
-
DisplayDirContents(strPath);
-
-
}
-
-
private void DisplayDirContents(string strPath)
-
{
-
-
-
// function to display list of folders and files in specified path
-
// define some arrays
-
DirectoryInfo[] aryDirectories;
-
FileInfo[] aryFiles;
-
-
// variable to store the complete file system path to the folder
-
string strFSPath = strDriveLetter + strPath;
-
-
// some string manipulation to get the name of the current script
-
string strCurrentScript = Request.ServerVariables["URL"];
-
string[] arrURL = strCurrentScript.Split('/');
-
strCurrentScript = arrURL[arrURL.Length - 1];
-
// instantiate local instance of DirectoryInfo object
-
DirectoryInfo objCurrentDirectory = new DirectoryInfo(strFSPath);
-
-
// get the directories present in the current folder
-
// as an array of DirectoryInfo objects
-
aryDirectories = objCurrentDirectory.GetDirectories();
-
-
// check if the current folder has any files
-
if (aryFiles.Length != 0)
-
{
-
-
// if it does, then iterate and
-
// display the information about each file
-
foreach (FileInfo objFile in aryFiles)
-
{
-
output.Text += objFile.Name;
-
output.Text += "<br />";
-
-
}
-
}
-
-
}
-
-
-
}
-
-
-
-
<asp:label id="output" runat="server" style="font: 14px, Arial"/>
-
-
Try this code converter tool.
Nathan
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Pan Am |
last post by:
My Web hosting service does not support multiple directories...
Can anyone suggest a Unix script that traverses a HTML tree and
produces a working "single directory" version of the same?
TIA
...
|
by: olle |
last post by:
Hi everyone.
Beging a newbee to asp.net and used to work with traditional asp I have
one problem working with a datalist.
1/ I make a dataset as as session variable like
session("employees")
2/...
|
by: SB |
last post by:
Hi,
I have a super-simple need to just walk the files in a single directory.
I thought this would do it, but "permanentFilelist" ends up containing
all folders in all subdirectories.
Could...
|
by: ammar_fake |
last post by:
Hello there.
I need a DataList to render the Gridview by providing one of the
DataList values as a query for the underlaying Gridview.
This does not work:
SelectCommand="select * from...
|
by: suresh_nsnguys |
last post by:
Hi,
I am working in digital signage application where user can upload image,flash and movie files .and later thay can view the uploaded files in digital LCD screen.
I am facing 1...
|
by: parshupooja |
last post by:
Hi All,
I am working in ASP.NET C#.
I have image folder in my application. I want to load all images in Gridview/datalist one column and second and third column with empty texboxes. I do not know...
|
by: mil111 |
last post by:
Hi,
can enybody help me please. I have a gridview with column that shows the images dynamically from database (see code below). What I need it to do is check to see if there is an image in each...
|
by: Sean |
last post by:
Hi, I've taken over a website, which has an admin section that is
currently open. I added Forms Authentication to the admin directory
with the using the location section in web.config:
...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |