Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm currently using an ASP.NET File Upload control. This works great, but I'd like to remove the current Upload button and put its logic into the Browse... button instead.

Is there a way to overload the Browse... button's logic?

Currently:

Photo upload current example

I'd like to have this:

No upload button

When the user clicks the Open button in the File Upload box, the Upload buttons' logic fires:

File to upload

Upon clicking Open, the following code triggers in C# Code behind.

protected void override btnSomeOverriddenControl_Click(object sender, EventArgs e)
{
    if (multipleFile.HasFiles)
    {
        foreach (var file in multipleFile.PostedFiles)
        {

            //do stuff
        }
    }
}
share|improve this question
    
You want the browse button to turn into an upload button after the person gets some files from the file system? –  Chris Jan 21 at 14:39
    
Yep! One less click, essentially. –  Mr. C Jan 21 at 15:26
    
You have to inject some css on the buton and change its inner html. You can do this easly with jquery or javascript. –  Chris Jan 23 at 15:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.