C# 如何将数据传递到另一个视图ASP.NET

C# 如何将数据传递到另一个视图ASP.NET,c#,asp.net,C#,Asp.net,我想从view1中的某个文本框中传递一些值,并在view2中需要这些值。我如何才能做到这一点。在view2中,我有一个用户控制器 UserForm.aspx <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0"> <asp:View ID="View1" runat="server"> <div style="height: 363px"&g

我想从view1中的某个文本框中传递一些值,并在view2中需要这些值。我如何才能做到这一点。在view2中,我有一个用户控制器

UserForm.aspx

    <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
        <asp:View ID="View1" runat="server">
            <div style="height: 363px">

        <asp:Label ID="Label1" runat="server" Text="Name"></asp:Label>&nbsp;
        <asp:TextBox ID="txtName" runat="server"></asp:TextBox>&nbsp;
        <asp:RequiredFieldValidator ControlToValidate="txtName" Text="This field is required"
          ForeColor="Red" runat="server"><img src="Images/icon_error_white.gif" alt="Error" />         </asp:RequiredFieldValidator><br />
        <asp:Label ID="Label2" runat="server" Text="Phone"></asp:Label>&nbsp;
        <asp:TextBox ID="txtPhone" runat="server"></asp:TextBox>&nbsp
        <asp:RequiredFieldValidator ControlToValidate="txtPhone" Text="This field is required"
            ForeColor="Red" runat="server"><img src="Images/icon_error_white.gif" alt="Error" /></asp:RequiredFieldValidator><br />
        <asp:Label ID="Label3" runat="server" Text="Doc"></asp:Label>&nbsp;
        <asp:TextBox ID="txtDoc" runat="server"></asp:TextBox>

        <asp:RequiredFieldValidator ControlToValidate="txtDoc" Text="This field is required"
                    ForeColor="Red" runat="server"><img src="Images/icon_error_white.gif" alt="Error" /></asp:RequiredFieldValidator>
                <asp:Button ID="Button1" runat="server" Style="z-index: 1; left: 16px; top: 176px; position: absolute"
                    Text="Create" />
                <br />
                <br />
            </div>
        </asp:View>
        <asp:View ID="View2" runat="server">
            <MSD:User ID="User1" runat="server" />
        </asp:View>
    </asp:MultiView>
</form>
UserControll.ascx

   <div>
        <asp:Label ID="Name" runat="server" Text="Name"></asp:Label>&nbsp;
        <asp:TextBox ID="txtName" runat="server"></asp:TextBox>&nbsp;
        <asp:Label ID="Doc" runat="server" Text="Doc"></asp:Label>&nbsp;
        <asp:TextBox ID="txtDoc" runat="server"></asp:TextBox>&nbsp;
        <hr />
    </div>
我需要将view1上的文本传递到view2,view2是控制器

我是ASP.NET和web编程的新手,所以任何帮助和评论都很有用
*注意:我不使用MVC型号

您能否指定以下内容:您标记为controller的部分中的文本是否也在UserForm.aspx中?如果没有,您能指定他们的URL是什么吗?另外,当您注意到您没有使用MVC应用程序体系结构时,为什么要将它们称为view1和view2?在.aspx世界中,通常我们称之为UserForm.aspx页面,它包含显示和应用程序逻辑。MVC试图将其分为视图和控制器,但在.aspx中不存在这种分离,使用这些术语会使问题听起来很混乱。@welegan,他使用的是多视图控件…编辑的控制器名称,当与View1一起使用时,它是默认的id,就像我说的,我是asp.net的新手,据我所知,这种类型的视图与MVC中的视图术语不同model@walther多谢你指出这一点。MoralesJosue:谢谢你编辑它,用户控制更有意义。
   <div>
        <asp:Label ID="Name" runat="server" Text="Name"></asp:Label>&nbsp;
        <asp:TextBox ID="txtName" runat="server"></asp:TextBox>&nbsp;
        <asp:Label ID="Doc" runat="server" Text="Doc"></asp:Label>&nbsp;
        <asp:TextBox ID="txtDoc" runat="server"></asp:TextBox>&nbsp;
        <hr />
    </div>