本文介绍了当我点击控制器时,我没有添加视图选项,我怎么能得到它。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Function userpage(ByVal form As FormCollection, ByVal file As HttpPostedFileBase) As ActionResult
        Dim mn As MVBC.userpage = New userpage()
        Dim q As String = mn.resume1

        mn.name = form("txtName")

        mn.phn = form("txtPhn")
        mn.highestedu = form("Education")
        mn.gender = form("Gender")
        mn.field = form("Field")
        mn.Email = form("txtEmail")
        Dim image As String = form("file1")
        Dim resume1 As HttpPostedFileBase = Request.Files("resume")
        Dim filetoUpload As HttpPostedFileBase = Request.Files("file1")
        If filetoUpload.FileName <> "" Then
            Dim ext As String = System.IO.Path.GetExtension(filetoUpload.FileName).ToLower()
            If ext <> ".jpg" AndAlso ext <> ".png" AndAlso ext <> ".jpeg" Then
                ViewBag.q = "Please Upload Valid Format Image"
                Return RedirectToAction("welcome", "Seema")
            Else

                Dim imagename As String = System.IO.Path.GetFileName(filetoUpload.FileName)
                '   Dim phyisal As String = Server.MapPath(Convert.ToString("~/Content/images/") & imagename)
                Dim path As String = System.IO.Path.Combine(Server.MapPath("~/Content/images"), imagename)
                filetoUpload.SaveAs(path)

                mn.filetoUpload = filetoUpload.FileName
                '  file.SaveAs(phyisal)
                ViewBag.q = "File Uploaded Successfully"
            End If
        End If
        Dim ext1 As String = System.IO.Path.GetExtension(resume1.FileName)
        If (ext1 <> ".doc") AndAlso (ext1 <> ".docx") AndAlso (ext1 <> ".pdf") Then
            ViewBag.q = "Please Upload Valid Format Resume"
            Return RedirectToAction("welcome", "Seema")
        Else
            mn.resume1 = mn.Email & resume1.FileName
            Dim resumenamwe As String = System.IO.Path.GetFileName(resume1.FileName)

            '   mn.resume1 = resumenamwe
            Dim respath As String = System.IO.Path.Combine(Server.MapPath("~/Content/Resumes"), mn.resume1)
            resume1.SaveAs(respath)
        End If

        ViewBag.m1 = mn

        ViewBag.xm = Createxml(mn)

        Return View()
    End Function
解决方案


这篇关于当我点击控制器时,我没有添加视图选项,我怎么能得到它。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 22:52