简体   繁体   English

删除FileUpload.GetHtml帮助器的上传按钮

[英]Remove upload button of FileUpload.GetHtml Helper

How can I remove the upload button helper FileUpload.GetHtml? 如何删除上传按钮助手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 . 使用代码删除它的唯一方法是将includeFormTag设置为false But then you'd lose all the rest of the post html. 但是那样的话,您将失去所有其余的html。 :) :)

However, since the html output is consistent you can just do a simple replace. 但是,由于html输出是一致的,因此您只需执行简单的替换即可。

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

It's rather ugly though. 不过这很丑。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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