C# 在多视图中无法获取文本框值

C# 在多视图中无法获取文本框值,c#,html,asp.net,C#,Html,Asp.net,我创建了一个多视图,其中有两个视图,一个用于获取一些信息,另一个用于发送消息。对于第一个视图,所有这些都非常有效,但是对于第二个视图,当我单击消息的submit按钮时,它不会响应,也不会启动它的功能。 有什么建议可以让它工作吗? HTML: 能否检查designer.cs文件中是否定义了按钮?您所说的定义是什么意思? <asp:UpdatePanel ID="UpdatePanel2" UpdateMode="Conditional" runat="server">

我创建了一个多视图,其中有两个视图,一个用于获取一些信息,另一个用于发送消息。对于第一个视图,所有这些都非常有效,但是对于第二个视图,当我单击消息的submit按钮时,它不会响应,也不会启动它的功能。
有什么建议可以让它工作吗?

HTML:


能否检查designer.cs文件中是否定义了按钮?

您所说的定义是什么意思?
<asp:UpdatePanel ID="UpdatePanel2" UpdateMode="Conditional" runat="server">
        <ContentTemplate>
            <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">

            <asp:View ID="View1" runat="server">
            <asp:Button ID="SendPM" style="margin-left: 112px; width: 170px; height: 30px; font-size: 20px; border-radius: 15px;" runat="server" Text="Send PM" onclick="SendPM_Click"/>

                <div style="position:relative; top: 3px; margin-left: 20px; font-size: 25px; color: black;">
                <i><% Response.Write(Session["ProfileEmail"].ToString()); %></i>
                </div>

                <br />
                <div style="margin-left: 35px; font-size: 20px; color: black;">
                <span style="font-size: 23px;">Firstname:</span> <i style="color:Green;"><% Response.Write(Session["ProfileFirstName"].ToString()); %></i>
                <br />
                <span style="font-size: 23px;">Lastname:</span> <i style="color:Green;"><% Response.Write(Session["ProfileLastName"].ToString()); %></i>
                <br />
                <span style="font-size: 23px;">PhoneNumber:</span> <i style="color:Green;"><% Response.Write(Session["ProfilePhoneNumber"].ToString()); %></i>
                <br />
                <span style="font-size: 23px;">Age:</span> <i style="color:Green;"><% Response.Write(Session["ProfileAge"].ToString()); %></i>
                </div>

            </asp:View>

            <asp:View ID="View2" runat="server"> <!-- Here is the view for the message -->
            <asp:Button ID="GoToDetails" style="margin-left: 112px; width: 170px; height: 30px; font-size: 20px; border-radius: 15px;" runat="server" Text="Details" onclick="GoToDetails_Click"/>
            <br />
            <br />
                <div style="margin-left: 50px;">
                    Title: <asp:TextBox ID="TitleOfPM" runat="server" ValidationGroup="messagegroup"></asp:TextBox>
                    <br />
                    <br />
                    Content: 
                    <asp:TextBox ID="ContentOfPM" TextMode="MultiLine" runat="server" ValidationGroup="messagegroup"></asp:TextBox>
                    <br />
                    **<asp:Button ID="SubmitPM" runat="server" Text="Submit" onclick="SubmitPM_Click" ValidationGroup="messagegroup" />**
                </div>
            </asp:View>


        </asp:MultiView> 
                 </ContentTemplate>
                     </asp:UpdatePanel>
protected void SendPM_Click(object sender, EventArgs e)
    {
        MultiView1.ActiveViewIndex = 1;
    }

    protected void GoToDetails_Click(object sender, EventArgs e)
    {
        MultiView1.ActiveViewIndex = 0;
    }

    protected void SubmitPM_Click(object sender, EventArgs e)
    {
        PrivateMessageInfo message = new PrivateMessageInfo();
        PrivateMessages u = new PrivateMessages();

        message.title = TitleOfPM.Text;
        message.content = ContentOfPM.Text;
        message.PMSender = Session["email"].ToString();
        message.SentTo = Session["ReplicateForEmail"].ToString();
        DateTime dt = DateTime.Now;
        message.SendDate = dt.ToShortDateString();

        u.SendPrivateMessage(message);
        Response.Redirect("HomePage.aspx?JobID=" + JobID);
    }