阅读背景:

我如何在C#mvc中使用OpenFileDialog

来源:互联网 

my Code is below

我的代码如下

 @Ajax.ActionLink("Choose File",
                            "chooseItemView",
                            new { },
                            new AjaxOptions
                            {
                                UpdateTargetId = "replaceDiv",
                                InsertionMode = InsertionMode.Replace,
                                HttpMethod = "GET",
                                //OnBegin = "startPreLoader",
                                OnSuccess = "stopPreLoader",
                                OnFailure = "stopPreLoader"
                            }, new
                            {
                                @id=1,
                                @type="file",
                                @class="btn btn-primary offset-top-2",
                                /*@id=item.GetHashCode().GetHashCode(),
                                 * onclick = "fileUploadFunction('" + item.GetHashCode().GetHashCode() + "')"*/
                                onclick = "fileUploadFunction('" + 1 + "')"
                            })



 public ActionResult chooseItemView()
    {
        /*MessageBox.Show("Hi");*/
        OpenFileDialog openFileDialog=new OpenFileDialog();
        openFileDialog.Multiselect = false;
        openFileDialog.Filter = "txt files (*.txt)|*.txt| DOC files (*.doc)|*.doc";
        openFileDialog.ShowDialog();
        return PartialView("_UploadItemView",null);
    }
 @Ajax.ActionLink("



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: