ridermansb
ridermansb

Reputation: 11059

Remove upload button of FileUpload.GetHtml Helper

How can I remove the upload button helper FileUpload.GetHtml?

    @FileUpload.GetHtml(
        initialNumberOfFiles:1,
        allowMoreFilesToBeAdded:true,
        includeFormTag:true,
        addText:"Adicionar",
        uploadText:"")

Upvotes: 1

Views: 1693

Answers (1)

Buildstarted
Buildstarted

Reputation: 26689

Unfortunately not. The only way to remove it using code is to set includeFormTag to false. But then you'd lose all the rest of the post html. :)

However, since the html output is consistent you can just do a simple replace.

@Html.Raw(FileUpload.GetHtml(
    initialNumberOfFiles:1,
    allowMoreFilesToBeAdded:true,
    includeFormTag:true,
    addText:"Adicionar",
    uploadText:"").ToString().Replace("<input value=\"\" type=\"submit\"/>", ""))

It's rather ugly though.

Upvotes: 1

Related Questions