I am using simple ASP.Net File Up loader inside an AJAX Update Panel.
But I am not accessing the Path and File Name
Can you help me to solve the issue and Suggest if any other way.
Thanx and Regards
Basically, file upload does not work inside the UpdatePanel.
But what do you want to access exactly? You cannot get the path of the client file anyway.
As Remy states above, uploading files within an update is not possible.
You can make use of a PostBackTrigger within your UpdatePanel:
PostBackTrigger
The above MSDN article contains a code listing for using a PostBackTrigger with a FileUpload control.
Other approaches available to you are to use an iframe on a separate page (see: ASP.NET - Upload File With Loading Image using JavaScript and C#) or to use one of the many third party components out there which make use of javascript and flash to upload files (Find links to a couple of the more popular ones below)
Uploadify
SWFUpload
Hope this helps.
Use ASP.NET AJAX ControlToolkit AsynFileUpload
AsyncFileUpload
You need to add a Postback trigger in update panel like this:
<Triggers>
<asp:PostBackTrigger ControlID="SubmitButtonId" />
</Triggers>
Hope this will help, Please let me know for any issues
Related
I have googled this with a couple of differing terms and I could not find my solution. What I want to do is to manipulate a webpage by editing its source, for example removing a part from the code maybe a div or so. I know how to get the source of a webpage and know how to change the code but I have no idea how to manipulate the page instantly, by for example removing an element.
Your help would be appreciated!
If you want to manipulate client code (HTML) what you need is Ajax.
You can use JQuery javascript library to manipulate html of a page adding, editing and removing html tags, scripts, etc.
Here you can find a decent tutorial as a start point.
If you want to manipulate server code (C# codebehind) what you need is creating a web project in visual studio (ASP.NET Web Application)
EDIT: As commented by #CSharpened both solutions are not mutual exclusive. You can have an ASP.NET Web application that uses Ajax to manipulate UI. In fact lot of people does that.
I would consider using AJAX. You can use either javascript or jquery coupled with html, asp.net and C# to achieve the results you are after.
For simple editing like removing divs or collapsing menus etc simple Javascript or jquery will suffice. However changing the coding of the page requires you to use AJAX or similar.
I am trying to create a form which allow async file uploading with asp.net. I realize you cannot upload a file with ajax per se so I am examining alternatives
What is the best way to do this? Create an Iframe on the page with the entire form including the file input? Can I on the parent to the frame have the submit button which forces the frame to submit and then displays some sort of spinner to indicate file is uploading? Ideally upon completion I'd like to redirect the user to another page. Is there a somewhat easy way to do this???
Have you tried using one of the jquery plugins vice doing it by hand?
http://aquantum-demo.appspot.com/file-upload
Why not use the ASP.NET AJAX Control Toolkit's AsyncFileUpload control? It's free and works pretty well.
You could use http://jquery.malsup.com/form/#file-upload
Have it post to a page that will handle a file upload on the server side in your usual way.
I like to have the page return JSON with a success/failure flag and message, then parse the response to determine if the upload succeeded.
I am using the Tiny slideshow in my asp.net page. It works fine in all the Browser and here is the LINK, But my problem starts when I include that page in my master page and display the same. the Jquery stop working in Internet explorer.
http://www.spareach.com/public/xtemp8.aspx?userid=22&AspxAutoDetectCookieSupport=1
I am tired a lot for this.
Can any one help me please.
your script interpreted by ASP.NET Session. the actual URL of file is http://www.spareach.com/lightbox3/script.js. if you put the absolute URL then they work fine. hope this helpful
If you include that in another page, your relative link to the .js file is going to be invalid. So, your options are to make it absolute (http://www.something.com/folder/tiny.js) or to include the .js from the head or common document, if you use that structure.
Can any one tell me what is the difference between both of them and also why File Upload control doesn't work with Update Panel?
It's not supported by web browsers.
Why don't file uploads work during async postbacks?
Please have a look at this thread.
I've been looking for a way to achieve this behavior and I found this sample project.
The trick in this project is that it changes the form target to an iframe created on the fly.
So far so good, I can get the byte[] on the server-side. But I need to change an image preview after the file is uploaded.
How can I get the iframe to update the main page? Would I have to save it on a file on the disk, make a javascript callback to change the image url? Is there another way to do this? What's recommended?
This control suggested by vorrtex actually causes a full page postback, am I missing something or is it the correct behavior?
I recommend you to use AsyncFileUploader and UpdatePanel. You have to save file on the disk but you can use C# for changing imageUrl.
Add a <script> block to the page that gets loaded in the <iframe> that interacts with the parent page and updates whatever you need to.
You can use the project mentioned below to preview the image before uploading. Working sample is also attached.
http://www.dotnetspider.com/resources/40858-Preview-Image-before-uploading-using.aspx
This uses AjaxControlToolKit's AsyncFileUploadControl and HTTPHandler to upload the image.