为什么我的代码隐藏不正常?

时间:2013-05-18 19:49:55

标签: asp.net code-behind

这是我的网络表单的代码隐藏文件。我无法得到某些论据可以正常使用我的表格。

    protected void btn_Submit_Click(object sender, EventArgs e)
    {//Enter arguments here...
    }
    protected void btn_Clear_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/ContentRequest/BMC_PR_Event.aspx", true);
    }
    protected void ShowForm()
    {
        Open.Visible = true;
        Success.Visible = false;
        Failure.Visible = false;
    }
    protected void ShowSuccess()
    {
        Open.Visible = false;
        Success.Visible = true;
        Failure.Visible = false;
    }
    protected void ShowFailure()
    {
        Open.Visible = false;
        Success.Visible = false;
        Failure.Visible = true;
    }

}

以下是我试图让它与之合作的代码......

        <asp:Button TabIndex="12" Text="Submit Request" ID="Button1" CssClass="submit" OnClientClick="return validateForm();" runat="server" onclick="btn_Submit_Click"></asp:Button>
        <asp:Button TabIndex="13" Text="Clear Fields" ID="Button2" CssClass="clear" UseSubmitBehavior="false" runat="server" onclick="btn_Clear_Click"></asp:Button>
        <asp:Label ID="Label1" runat="server"></asp:Label>
    </div>
</asp:Panel>
    <asp:Panel ID="Success" Visible="false" runat="server">
        <div class="message"><p>Your submission was sucessful.</p><p>An email receipt has been sent to the address provided with the details of this request.</p><p>Thank you.</p></div>
    </asp:Panel>
    <asp:Panel ID="Failure" Visible="false" runat="server">
        <div class="message">
            <p>There was an error with your request.  If this persists, please report your trouble to _OHE Web Strategies.</p>

不知道我还能在这做什么......

- 编辑 - 这是我得到的错误......

enter image description here

1 个答案:

答案 0 :(得分:3)

根据您粘贴的代码,我无法看到Panel'打开'的ID控件。请执行以下操作之一。

  1. 如果您需要另一个面板来启用“打开”功能,请添加另一个asp:Panel并使用“打开”
  2. 如果您已经删除了“打开”面板,请删除与此相关的代码(来自您案例中的代码)。
  3. 祝你好运

    詹姆斯