Uploading single file using jquery in asp.net - asp.net

i want to implement the simple file upload without flash.. and single file, but with jquery, there should not be any postbacks...
can anyone suggest some jquery code for uploading file to the server.
thanks in advance

Since you are only trying to upload a single file, I would use the upload control and then use a JQuery progress bar like one of the controls here:
http://dj.codeplex.com/
If you use the extender and updatepanel, there will be no postbacks.

Related

Reusable jquery dialog

I am using ASP.NET 3.5 with C# 2008.
I want to use a JQuery dialog for showing error message.
For this I need to include a CSS, a JavaScript file into aspx page. Also have to create a <div> with specific Id or class and have to put some buttons like OK, Cancel inside it. Also have to put a label inside <div>. And have to create a <script> block which contains functions to Open or Close the dialog.
All this working fine in single aspx page. But now I want to use this across all the pages and also don't want to make repetitive codes.
So what will be the best way to implement it? Should I put all these stuff inside a user-control and import it into every aspx page where I want to use that dialog? Or any other best way to achieve this?
You can put your javascript code into a js file and add the reference of that js file into your master page then you can call the jquery error dialog into your application.

Dynamically loading asp.net controls with javascript

I am developing a series of ASP.NET controls that allow for a dynamically created sites where the layout gets generated from a class.cs file, the controls then get Loaded into an Placeholder in an update panel.
what I am hoping to achieve is using stuff like ajax to build the screen with javascript.
can you guys maybe point me in the right direction,
my google is not helping today.
I want to use stuff like ajax, json
thanks in advance
Javascript is a client-side scripting language and cannot be used to trigger loading of server-side controls.
You can use ASP.NET elements like etc., which have runat=server to trigger server side code, though.
Through AJAX? Not possible without page reload.

Upload file to ASP.Net Server without using FileUpload Control

In my ASP.Net website I want to upload a file onClickEvent of LinkButton. I dont have a space to show a FileUpload Control. But if we use fileUpload control it is easy to upload a file using:
String filename = Path.GetFileName(FileUpload1.FileName);
FileUpload1.SaveAs(Server.MapPath("~/files/") + filename);
How do I open file browser on onClick event of LinkButton and save my file inside the Files folder present on the server?
EDIT:
can we use "OpenFileDialog" From Windows.Forms? If yes, how? i am just asking...
You can use javascript as suggested by Neil Thompson. However, my preferred solution to this issue is the CSS method as described in this post. You can also use the ASP upload control if you wish, and it will be hidden in the same way, allowing you to handle the file in the code behind as you usually would.
Also, as far as I can tell this works in all popular browsers.

How to use drag and drop to upload files in database in asp.net

I want to upload one file on server as well as want to save the uploaded file in the database. I want to use only one drag and drop operation. I don't want to use any button click event. Kindly give me suggestion how can i do this and if possible provide me code.
Thanks
Check this jquery file-upload plugin
http://blueimp.github.com/jQuery-File-Upload/
--Nitin

ajax image upload and preview in asp.net

i have created a webform.in that there is file upload.
i want to upload the image and show the thumbnail image on fileupload select,and On page submit i want to save the image path to database.
how can u implement it using ajax.
Thanks in advance.
Strictly speaking there is no way to implement an actual ajax file upload as its not supported by browsers. Html 5 has a lot more stuff you can do with file uploads.
You can implement your own hack using iframes, I have done this before. Basically you have an iframe that just has a form with the fileupload control on it and auto submit the form then call out to the parent window to update it when complete.
Alternatively use a pre built control something like the telerik one, you should be able to find a free one. http://www.telerik.com/products/aspnet-ajax/upload.aspx.

Resources