简体   繁体   中英

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:"")

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM