这是我的编辑页面,我在编辑id显示值时遇到了问题但是当我点击按钮时它没有执行任何操作 [英] this is my edit page i got problem while editing id displaiying values but while i click button it does not perfom any actio

查看:63
本文介绍了这是我的编辑页面,我在编辑id显示值时遇到了问题但是当我点击按钮时它没有执行任何操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

@model iqmsampleworks_project.Areas.admin.Models.ConfigDTO

@{
    ViewBag.Title = "editproject";
    Layout = "~/Areas/admin/Views/Shared/_LayoutPage1.cshtml";
  @Styles.Render("~/Content/css/style (2).css")
     @Styles.Render("~/Content/themes/base/css")
}

<script type="text/javascript">
    function showSecond() {
        $('#second').show();
        $('#btn1').hide();
    }
    function showThird() {
        $('#third').show();
        $('#btn2').hide();
    }
    function showfourth() {
        $('#fourth').show();
        $('#btn3').hide();
    }
    function show5() {
        $('#5').show();
        $('#btn4').hide();
    }
    function show6() {
        $('#6').show();
        $('#btn5').hide();
    }
    function show7() {
        $('#7').show();
        $('#btn6').hide();
    }
    function show8() {
        $('#8').show();
        $('#btn7').hide();
    }
    function show9() {
        $('#9').show();
        $('#btn8').hide();
    }
    function show10() {
        $('#10').show();
        $('#btn9').hide();
    }
</script>
@{
    var fileName = "";
    if (IsPost) {
        var fileSavePath = "";
        var uploadedFile = Request.Files[0];
        fileName = Path.GetFileName(uploadedFile.FileName);
        fileSavePath = Server.MapPath("~/App_Data/UploadedFiles/" +
          fileName);
        uploadedFile.SaveAs(fileSavePath);
    }
    }
<script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")"></script>
  <script src="@Url.Content("~/Scripts/jquery.validate.min.js")"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")"></script>
    <script type="text/javascript">
        function readURL(input) {
            if (input.files && input.files[0]) {
                var reader = new FileReader();
                reader.onload = function (e) {
                    $('#FilePath').attr('src', e.target.result);
                };
                reader.readAsDataURL(input.files[0]);
            }
        }
         </script>
@using (Html.BeginForm("editproject", "admin", null, FormMethod.Post, new { enctype = "multipart/form-data" }))

{
     @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <div style="float:left;width:auto;height:auto;margin-removed10px;margin-removed10px;">
    <div style="margin-removed0px;margin-removed60px;font-weight:bold;font-size:24px;"><span style="color:blue;">Edit project</span></div>
    
</div>
    <div style="float:left;margin-removed100px;margin-removed123px;height:auto;width:600px;border:1px solid white;margin-removed50px;border-radius:5px;">

        <div style="float:left;height:auto;width:auto;"> 
     <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
  Technology
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
          @Html.DropDownListFor(model => model.DomainId,
             new SelectList((System.Collections.IEnumerable)ViewData["ddltech"],"tid","technology"),
            "Select technology"
           ,new {onchange="fillTypes(this)",id="tech",@Style = "width:170px;height:25px;"})
            @Html.ValidationMessageFor(model => model.DomainId)</div>
           </div>
                     <div style="float:left;height:auto;width:auto;"> 
     <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
  Type
     </div>
        <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
          @Html.DropDownListFor(model => model.MID,
             new SelectList((System.Collections.IEnumerable)ViewData["ddltype"],"pid","type"),
            "Select type",
            new {onchange="fillTypes1(this)",@Style = "width:170px;height:25px;"})
            @Html.ValidationMessageFor(model => model.MID)</div>
           </div>
    <div style="float:left;margin-removed25px;margin-removed150px;width:160px;color:black;font-size:15px;">
 Category
     </div>
        <div style="margin-removed125px;margin-removed190px;color:black;width:500px;color:red;">
          @Html.DropDownListFor(model => model.TID,
             new SelectList((System.Collections.IEnumerable)ViewData["ddlcate"],"PID1","addtype"),
            "Select category",
            new { @Style = "width:170px;height:25px;" ,id="tech1"})
            @Html.ValidationMessageFor(model => model.TID)
          </div>
     
       
      
       <div style="float:left;height:auto;width:auto;"> 
     <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
Sample name
     </div>
   
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.projectname )
                        @Html.ValidationMessageFor(model => model.projectname)</div>
           </div>
          <div style="float:left;height:auto;width:auto;"> 
     <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
Developed By
     </div>
   
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
        @Html.DropDownListFor(model => model.EID,
             new SelectList((System.Collections.IEnumerable)ViewData["ddltech1"],"eid","name"),
            "Select technology"
           ,new {@Style = "width:170px;height:25px;"})
            @Html.ValidationMessageFor(model => model.EID)</div>
           </div>
         @*<div style="float:left;margin-removed25px;margin-removed150px;width:160px;color:black;font-size:15px;">
 Category
     </div>
        <div style="margin-removed125px;margin-removed190px;color:black;width:500px;color:red;">
          @Html.DropDownListFor(model => model.TID,
             new SelectList((System.Collections.IEnumerable)ViewData["ddlcate"],"PID1","addtype"),
            "Select category",
            new { @Style = "width:170px;height:25px;" ,id="tech1"})
            @Html.ValidationMessageFor(model => model.TID)
          </div>
        <div style="float:left;margin-removed25px;margin-removed150px;width:160px;color:black;font-size:15px;">
  Developed By
     </div>
        <div style="margin-removed125px;margin-removed190px;color:black;width:500px;color:red;">
           @Html.DropDownListFor(model => model.EID,
             new SelectList((System.Collections.IEnumerable)ViewData["ddltech1"],"eid","name"),
            "Select technology"
           ,new {@Style = "width:170px;height:25px;"})
            @Html.ValidationMessageFor(model => model.EID)
          </div>*@
  
        
         <div style="float:left;height:auto;width:auto;"> 
     <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
    url
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.url)
                        @Html.ValidationMessageFor(model => model.url)</div>
           </div>

         <div style="float:left;height:auto;width:auto;"> 
     <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
    url
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.url)
                        @Html.ValidationMessageFor(model => model.url)</div>
           </div>
         <div style="float:left;height:auto;width:auto;"> 
     <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:16px;font-weight:bold;">
    Login Details


     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red; display:none">
      azsdfsdf  </div>
           </div>
   <div style="float:left;height:auto;width:auto;" id="one"> 
                 <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
    User Type
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.UserType)
                                          @Html.ValidationMessageFor(model => model.UserType)</div>
                 <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
 User name
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.Useranme)
                                          @Html.ValidationMessageFor(model => model.Useranme)</div>
     <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
Password
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.Password)
                                          @Html.ValidationMessageFor(model => model.Password) @if(@Model.UserType1==null){<input type="button" value="add" id="btn1" onclick="showSecond();" class="myButton1" />} </div>
          </div>       
        @if (@Model.UserType1 != null ||         )
        {
            <div style="float:left;height:auto;width:auto;" id="second"> 
                 <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
    User Type
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.UserType1)
                                          @Html.ValidationMessageFor(model => model.UserType1)</div>
                 <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
 User name
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.Useranme1)
                                          @Html.ValidationMessageFor(model => model.Useranme1)</div>
     <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
Password
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.Password1)
                                          @Html.ValidationMessageFor(model => model.Password1) 
                                                                                                @*<input type="button" value="add" id="btn2" onclick="showThird();" class="myButton1" />*@ @if(@Model.UserType2==null){<input type="button" value="add" id="btn2" onclick="    showThird();" class="myButton1" />}</div>
          </div>      }
       @if(@Model.UserType2!=null){
    <div style="float:left;height:auto;width:auto;" id="third"> 
    
  
   <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
  User Type
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.UserType2)
                                          @Html.ValidationMessageFor(model => model.UserType2)</div>
                 <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
 User name
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.Useranme2)
                                          @Html.ValidationMessageFor(model => model.Useranme2)</div>
     <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
Password
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.Password2)
                                          @Html.ValidationMessageFor(model => model.Password2)<input type="button" value="add" id="btn3" onclick="showfourth();" class="myButton1" /></div>
           </div> 
        }
   <div style="float:left;height:auto;width:auto;display:none" id="fourth"> 
       <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
       User Type
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.UserType3)
                                          @Html.ValidationMessageFor(model => model.UserType3)</div>
                 <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
 User name
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.Useranme3)
                                          @Html.ValidationMessageFor(model => model.Useranme3)</div>
     <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
Password
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.Password3)
                                          @Html.ValidationMessageFor(model => model.Password3)
<input type="button" value="add" id="btn4" onclick="show5();" class="myButton1" /></div>
           </div>   
     <div style="float:left;height:auto;width:auto;display:none" id="5"> 
     <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
    User Type
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.UserType4)
                                          @Html.ValidationMessageFor(model => model.UserType4)</div>
                 <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
 User name
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.Useranme4)
                                          @Html.ValidationMessageFor(model => model.Useranme4)</div>
     <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
Password
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.Password4)
                                          @Html.ValidationMessageFor(model => model.Password4)
<input type="button" value="add" id="btn5" onclick="show6();" class="myButton1" /></div>
           </div> 
    <div style="float:left;height:auto;width:auto;display:none" id="6"> 
    <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
    User Type
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.UserType5)
                                          @Html.ValidationMessageFor(model => model.UserType5)</div>
                 <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
 User name
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.Useranme5)
                                          @Html.ValidationMessageFor(model => model.Useranme5)</div>
     <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
Password
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.Password5)
                                          @Html.ValidationMessageFor(model => model.Password5)
<input type="button" value="add" id="btn6" onclick="show7();" class="myButton1" /></div>
           </div>
    
          <div style="float:left;height:auto;width:auto;display:none" id="7"> 
               <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
    User Type
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.UserType6)
                                          @Html.ValidationMessageFor(model => model.UserType6)</div>
                 <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
 User name
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.Useranme6)
                                          @Html.ValidationMessageFor(model => model.Useranme6)</div>
     <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
Password
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.Password6)
                                          @Html.ValidationMessageFor(model => model.Password6)<input type="button" value="add" id="btn7" onclick="show8();" class="myButton1" /></div>
           </div> 
        <div style="float:left;height:auto;width:auto;display:none" id="8"> 
           <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
   User Type
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.UserType7)
                                          @Html.ValidationMessageFor(model => model.UserType7)</div>
                 <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
 User name
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.Useranme7)
                                          @Html.ValidationMessageFor(model => model.Useranme7)</div>
     <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
Password
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.Password7)
                                          @Html.ValidationMessageFor(model => model.Password7)<input type="button" value="add" id="btn8" onclick="show9();" class="myButton1" /></div>
           </div> 
         <div style="float:left;height:auto;width:auto;display:none" id="9"> 
     <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
   User Type
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.UserType8)
                                          @Html.ValidationMessageFor(model => model.UserType8)</div>
                 <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
 User name
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.Useranme8)
                                          @Html.ValidationMessageFor(model => model.Useranme8)</div>
     <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
Password
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.Password8)
                                          @Html.ValidationMessageFor(model => model.Password8)<input type="button" value="add" id="btn9" onclick="show10();" class="myButton1" /></div>
           </div> 
         <div style="float:left;height:auto;width:auto;display:none" id="10"> 
 <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
   User Type
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.UserType9)
                                          @Html.ValidationMessageFor(model => model.UserType9)</div>
                 <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
 User name
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.Useranme9)
                                          @Html.ValidationMessageFor(model => model.Useranme9)</div>
     <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
Password
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.EditorFor(model => model.Password9)
                                          @Html.ValidationMessageFor(model => model.Password9)</div>
           </div> 

   
        <div style="float:left;height:auto;width:auto;"> 
     <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
Description
     </div>
             <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.TextAreaFor(model => model.Decription)
                        @Html.ValidationMessageFor(model => model.Decription)</div>
           </div> 
          <div style="float:left;height:auto;width:auto;"> 
     <div style="float:left;margin-removed30px;margin-removed150px;width:150px;color:black;font-size:15px;">
 Upload 
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
        <input id="FilePath" title="Upload a product image" type="file" name="file" onchange="readURL(this)"  data-val="true" data-val-required="please select a file" style="width:auto"/></div>
           </div>
       
     @*<div style="float:left;height:auto;width:auto;color:red;"> 
     <div style="float:left;margin-removed30px;margin-removed150px;width:100px;color:black;font-size:15px;">
     Description
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;">
         @Html.TextAreaFor(model => model.Decription)
                        @Html.ValidationMessageFor(model => model.Decription)</div>
           </div> 
         <div style="float:left;height:auto;width:auto;"> 
     <div style="float:left;margin-removed30px;margin-removed150px;width:100px;color:black;font-size:15px;">
     Upload 
     </div>
     <div style="float:left;margin-removed30px;margin-removed10px;color:red;width:250px;">

                        <input id="FilePath" title="Upload a product image" type="file" name="file" onchange="readURL(this)"  data-val="true" data-val-required="please select a file" style="width:auto"/>
     

     </div>
           </div>*@
   <div style="float:left;height:auto;width:auto;"> 
     <div style="float:left;margin-removed30px;margin-removed150px;width:100px;color:black;font-size:15px;margin-removed50px;">
    <input type="submit" value="Update"  class="myButton" />
     </div>
          <div style="float:left;margin-removed30px;margin-removed50px;">
          <a id="button" href="@Url.Action(" addproject1=", new { domainid = @Model.DomainId, id = @Model.MID, id1 = @Model.TID })"><input type="button" value="Cancel"  class="myButton"/></a></div>
           </div>
    
    
   </div>
    
    
}

<script type="text/javascript">
    function fillTypes(a) {
        //alert(ddl.value);

        var url = '@Url.Action("editproject")?id=' + a.value;
         document.location = url;

     }
    function fillTypes(a) {
        //alert(ddl.value);
    
        var url = '@Url.Action("editproject")?domainid=' + a.value;
        document.location = url;

    }

    function fillTypes1(b) {
        var tech = $('#tech').val();
        var url1 = '@Url.Action("editproject")?id1=' + b.value + "&domainid=" + tech;
       document.location = url1;
   }
     function fillTypes2(c) {
         var tech = $('#tech').val();
         var tech1 = $('#tech1').val();
        var url1 = '@Url.Action("viewproject4")?id=' +tech1 + "&domainid=" + tech;
       document.location = url1;
   }
</script>

推荐答案

('#second').show();


('#btn1').hide();
}
function showThird() {
('#btn1').hide(); } function showThird() {


('#third').show();


这篇关于这是我的编辑页面,我在编辑id显示值时遇到了问题但是当我点击按钮时它没有执行任何操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆