How to show “success” message on submit?

前端 未结 4 738
再見小時候
再見小時候 2020-12-20 20:27

Using C# with ASP.NET, how do I show a \"success\" message when my user submits a form? And at the same time say \"The image has successfully saved\", with a link, so that t

4条回答
  •  执笔经年
    2020-12-20 20:48

    Wrap your form in an and create another with Visible="False" for your Thank you message. Once the form is submitted, change the visibility of each panel, setting the form to Visible="False", and the thank you message panel to Visible="True".

    Hope that makes sense, here's an example:

    
        ... form fields here ...
    
    
    
        ... Thank you message here ...
    
    

    Then inside your codebehind

    protected void btnSubmit_Click(object sender, EventArgs e) {
        // Hook up uploaded image and assign link to it
        pnlFormFields.Visible = false;
        pnlThankYouMessage.Visible = true;
    }
    

提交回复
热议问题