im having difficulties, pls advise...
1) filtering my FileUpload to only .txt file
2) read .txt file and bind to gridview,
the text file contains e.g. 1234; 9584; 2384;
i want to bind it to my gridview which have just one column

Please Advise...with c# codes.
thanks

Check the Content type before saving the file to a particular location using

FileUpload1.PostedFile.ContentType

ishamputra,

String ext=System.IO.Path.GetExtension(FileUpload1.FileName).ToUpper();

if(ext==".TXT") 
  {
    String content=System.Text.Encoding.ASCII.GetString(FileUpload1.FileBytes)
    String []ar=content.Split(';');
    GridView1.DataSource=ar;
    GridView1.DataBind();
  }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.