Click here to Skip to main content
15,890,512 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Convert text into hyperlinkable email dynamically Pin
Richard Deeming22-Oct-13 11:01
mveRichard Deeming22-Oct-13 11:01 
Questionsession related problem Pin
Member 1028388122-Oct-13 7:03
professionalMember 1028388122-Oct-13 7:03 
QuestionGridView binding Image Not working Pin
Member 1045459222-Oct-13 3:14
professionalMember 1045459222-Oct-13 3:14 
AnswerRe: GridView binding Image Not working Pin
Richard Deeming22-Oct-13 3:40
mveRichard Deeming22-Oct-13 3:40 
GeneralRe: GridView binding Image Not working Pin
Member 1045459222-Oct-13 8:01
professionalMember 1045459222-Oct-13 8:01 
QuestionUploading an Image Pin
Member 1031225720-Oct-13 18:29
Member 1031225720-Oct-13 18:29 
AnswerRe: Uploading an Image Pin
Abhinav S21-Oct-13 18:35
Abhinav S21-Oct-13 18:35 
AnswerRe: Uploading an Image Pin
Pratik Bhuva1-Nov-13 4:14
professionalPratik Bhuva1-Nov-13 4:14 
Code To upload Your Image to folder

C#
YourFunctionToUploadImage()
{
  //Check FileUpload controll has File Or not
  if (ImageFileUploadControll.HasFile)
  { 
         string fileExtention = System.IO.Path.GetExtension(ImageFileUploadControll.FileName);
         //Check For Valid Extension
            if (fileExtention.ToLower() != ".jpg" && fileExtention.ToLower() != ".jpeg" && fileExtention.ToLower() != ".png")
            {
                lblUploadstatus.Text = "Invalid File Choose .jpg/.jpeg/.png/.gif";
            }
            else
            {
                    //check if file already Exists in Folder
                    if (File.Exists(Server.MapPath("~/Folder_Name/" + ImageFileUploadControll.FileName)))
                    {
                        lblUploadstatus.Text = "File Already Exists. Rename filename";
                    }
                    else
                    {
                        //To Save Image To your Specific Location.
                        //srever.mappath takes us to Folder which containing our application
                        ImageFileUploadControll.SaveAs(Server.MapPath("~/Folder_Name/" + ImageFileUploadControll.FileName));
                        lblUploadstatus.Text = "Upload Status : File Uploaded Successfully";
                    } 
            }
            
   }
   else 
   {
      lblUploadstatus.Text = "Please Select File";
   }
}


Code To Retrive All Images form Folder and display in image_control you can use

C#
PageLoadEvent()
{
    //use DirectoryInfo to get all imageFile's Information
    DirectoryInfo dir = new DirectoryInfo(Server.MapPath("~/Folder_Name/"));
    FileInfo[] fi = dir.GetFiles();

    //Now you just need to create new image control each time and add ImageUrl to it
    foreach(FileInfo f in fi)
    {
         string imageUrl = f.ToString();
         Image img = new Image();
         img.ImageUrl = "~/Folder_Name/"+"imageUrl";
    }
}


Hope This Help
Pratik Bhuva
---------------
The night is darkest just before the dawn. And I promise you, the dawn is coming

Questioninterview questions Pin
ananta117-Oct-13 7:46
ananta117-Oct-13 7:46 
AnswerRe: interview questions Pin
Richard MacCutchan17-Oct-13 7:59
mveRichard MacCutchan17-Oct-13 7:59 
AnswerRe: interview questions Pin
R. Giskard Reventlov17-Oct-13 8:07
R. Giskard Reventlov17-Oct-13 8:07 
AnswerRe: interview questions Pin
thatraja17-Oct-13 21:54
professionalthatraja17-Oct-13 21:54 
AnswerRe: interview questions Pin
Abhinav S19-Oct-13 21:20
Abhinav S19-Oct-13 21:20 
QuestionStretching an Image in a Table cell (IE7) Pin
Blikkies17-Oct-13 4:54
professionalBlikkies17-Oct-13 4:54 
QuestionFiltering - web api c# Pin
miss78617-Oct-13 0:01
miss78617-Oct-13 0:01 
AnswerRe: Filtering - web api c# Pin
Bernhard Hiller17-Oct-13 2:29
Bernhard Hiller17-Oct-13 2:29 
AnswerRe: Filtering - web api c# Pin
Kornfeld Eliyahu Peter17-Oct-13 2:30
professionalKornfeld Eliyahu Peter17-Oct-13 2:30 
GeneralRe: Filtering - web api c# Pin
miss78617-Oct-13 3:51
miss78617-Oct-13 3:51 
GeneralRe: Filtering - web api c# Pin
Kornfeld Eliyahu Peter17-Oct-13 4:23
professionalKornfeld Eliyahu Peter17-Oct-13 4:23 
GeneralRe: Filtering - web api c# Pin
miss78617-Oct-13 4:39
miss78617-Oct-13 4:39 
QuestionRe: Filtering - web api c# Pin
Kornfeld Eliyahu Peter17-Oct-13 7:13
professionalKornfeld Eliyahu Peter17-Oct-13 7:13 
SuggestionRe: Filtering - web api c# Pin
Richard Deeming17-Oct-13 4:30
mveRichard Deeming17-Oct-13 4:30 
QuestionDisplaying "File Name: 002.txt" in Hebrew Pin
civic06016-Oct-13 4:42
civic06016-Oct-13 4:42 
AnswerRe: Displaying "File Name: 002.txt" in Hebrew Pin
Kornfeld Eliyahu Peter16-Oct-13 5:57
professionalKornfeld Eliyahu Peter16-Oct-13 5:57 
GeneralRe: Displaying "File Name: 002.txt" in Hebrew Pin
civic06016-Oct-13 9:46
civic06016-Oct-13 9:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.