显示/隐藏面板在ASP.net C#提交表单之后 [英] Show/Hide panels in ASP.net C# after submitting form

查看:682
本文介绍了显示/隐藏面板在ASP.net C#提交表单之后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此​​,在与confirm.aspx确认页面结合我Default.aspx的表单页面的过程中,我要创建面板和显示/在页面初始加载隐藏它们。

的形式是评论/投诉表格,因此用户将提交自己的信息,并生成一封电子邮件,然后发送到网络高手。

我有4个面板:面板1 + 3显示在默认情况下并设置为可见像这样的剧本早:

 保护无效的Page_Load(对象发件人,EventArgs的发送)
{
    Panel1.Visible = TRUE;
    Panel2.Visible = FALSE;
    Panel3.Visible = TRUE;
    Panel4.Visible = FALSE;
}

基本上,我想面板1 + 3成为隐藏和2 + 4,一旦用户提交表单,并没有错误的论坛内发现变得可见。

请问我运行的脚本来更改在<$ C C>尝试功能时,发送电子邮件,或右前<$ C C> frmReset 功能?

此外,有没有我需要将切换面板知名度提交后,没有错误的形式找到了一个特异功能? (除了改变能见度真正和<$ C C>假)


<格CLASS =h2_lin>解决方案

根据您的意见,您将解决分两步您的要求。

1,更新你的页面加载,以避免恢复可视性更改后:

 保护无效的Page_Load(对象发件人,EventArgs的发送)
{
    如果(!Page.IsPostBack){
        Panel1.Visible = TRUE;
        Panel2.Visible = FALSE;
        Panel3.Visible = TRUE;
        Panel4.Visible = FALSE;
    }
}

2,你必须改变对能见度尝试方法:

 <$ C C>保护无效Try_Click(对象发件人,EventArgs的发送)
{
    Panel1.Visible = FALSE;
    Panel2.Visible = TRUE;
    Panel3.Visible = FALSE;
    Panel4.Visible = TRUE;
}

So in the process of combining my default.aspx form page with the confirm.aspx confirmation page, I had to create panels and show/hide them at the initial loading of the page.

The form is a comment/complaint form, so users will submit their info, and an e-mail is generated and sent to a web master.

I have 4 panels: Panels 1 + 3 show by default and are set to visible early in the script like so:

protected void Page_Load(object sender, EventArgs e)
{
    Panel1.Visible = true;
    Panel2.Visible = false;
    Panel3.Visible = true;
    Panel4.Visible = false;
}

Basically, I want panels 1+3 to become hidden, and 2 + 4 to become visible once the user submits the form and no errors are found within the forum.

Would I run the script to change the visibility at the try function when an email is sent, or right before the frmReset function?

Also, is there a specific function I need that will switch the panels visibility AFTER submitting the form with no errors found? (Other than changing visibility to true or false)

解决方案

According your comments, you will resolve your requirement in two steps.

1st, update your page load to avoid reverting visibility after you change it :

protected void Page_Load(object sender, EventArgs e)
{
    if(!Page.IsPostBack){
        Panel1.Visible = true;
        Panel2.Visible = false;
        Panel3.Visible = true;
        Panel4.Visible = false;
    }
}

2nd, you have to change the visibility on the try method :

protected void Try_Click(object sender, EventArgs e)
{
    Panel1.Visible = false;
    Panel2.Visible = true;
    Panel3.Visible = false;
    Panel4.Visible = true;   
}

这篇关于显示/隐藏面板在ASP.net C#提交表单之后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆