Asp.net mvc aspx至mvc microsoft visual studio 2012

Asp.net mvc aspx至mvc microsoft visual studio 2012,asp.net-mvc,asp.net-mvc-3,model-view-controller,Asp.net Mvc,Asp.net Mvc 3,Model View Controller,我不知道如何将此代码更改为MVC, 有人能帮我吗 或者向我解释我该怎么做 它是关于修改和编辑的 删除数据库的组件 我需要理解它,并以max的身份在3天内完成它。许多thx: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="1_DetailsView.aspx.cs" Inherits="GridView_Edit._1_DetailsView" %> <!DOCTYPE html PUBLI

我不知道如何将此代码更改为MVC, 有人能帮我吗 或者向我解释我该怎么做

它是关于修改和编辑的 删除数据库的组件

我需要理解它,并以max的身份在3天内完成它。许多thx:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="1_DetailsView.aspx.cs"          Inherits="GridView_Edit._1_DetailsView" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
   <title></title>
</head>
<body>
  <form id="form1" runat="server">
  <div>
    <asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="299px" 
        AutoGenerateRows="False" DataKeyNames="idL" DataSourceID="SqlDataSource1" 
        AllowPaging="True" CellPadding="4" ForeColor="#333333" GridLines="None">
        <AlternatingRowStyle BackColor="White" />
        <CommandRowStyle BackColor="#D1DDF1" Font-Bold="True" />
        <EditRowStyle BackColor="#2461BF" />
        <FieldHeaderStyle BackColor="#DEE8F5" Font-Bold="True" />
        <Fields>
            <asp:BoundField DataField="idL" HeaderText="idL" InsertVisible="False" 
                ReadOnly="True" SortExpression="idL" />
            <asp:BoundField DataField="krstne" HeaderText="krstne" 
                SortExpression="krstne" />
            <asp:BoundField DataField="spec" HeaderText="spec" SortExpression="spec" />
            <asp:BoundField DataField="datNar" HeaderText="datNar" 
                SortExpression="datNar" />
            <asp:CommandField ShowEditButton="True" />
            <asp:CommandField ShowInsertButton="True" />
            <asp:CommandField ShowDeleteButton="True" />
        </Fields>
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#EFF3FB" />
    </asp:DetailsView>
    <!-- Datum sa neUpdejtuje ;) -->
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:PoliklinikaConnectionString3 %>" 
        SelectCommand="SELECT * FROM [Lekari]"
        UpdateCommand="Update [Lekari] SET krstne=@krstne, spec=@spec WHERE idL=@idL" 
        InsertCommand="Insert [Lekari] Values(@krstne, @spec, @datNar)"
        DeleteCommand="Delete [Lekari] Where  idL=@idL"
        ></asp:SqlDataSource>

   </div>
   </form>
 </body>
</html>

MVC是构建web应用程序的一种完全不同的方法。最大的区别是取消了web控件,而使用了更轻量级的HTML助手。既然您提出了这个问题,我想您可能需要更好地理解MVC,以便了解如何满足现有Web表单应用程序的业务需求,并将其应用于MVC应用程序


我知道你的时间有限,但我建议你去看看。试图在没有至少这种理解的情况下仓促进入解决方案,只会对您自己和您的客户造成伤害。

如果这只是编辑/删除与数据库表直接相关的项的功能,那么您可以在ASP.NET MVC中实现这一功能,并且大部分是开箱即用的功能。从书呆子晚餐教程开始,了解ASP.NETMVC是如何工作的。如果您希望从WebForms到MVC逐行转换,那么您将导致比您解决的问题更多的问题。