HI,
I have written code for image uploading, when i upload image then text in other controls gets cleared, whole page get refreshed , then how to prevent this whole page refreshing in javascript or html.

Without seeing the code used it's difficult to know whether you are uploading the image separately or as you submit the whole form.

If submitting the image with the other form fields, and staying on the same page to provide a preview, then yes the form will need to refresh, but to maintain the data in other fields, simply seed them from the request form, for example specify their value like...

<input type="text" name="name" value="<%= request("Name") %>">

Uploading images usually involves using enctype="multipart/form-data" which complicates field retrieval, in which case you can use...

<input type="text" name="name" value="<%= strUploadName %>">

after retrieving strUploadName, and how you do this will vary according to which component you used for the image upload. Personally, I prefer not to use components for things as simple as image upload, and instead use a Classic ASP function that can be modified at will.

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.