警报并在Asp.Net中发布页面 [英] Alert and Post the page in Asp.Net

查看:64
本文介绍了警报并在Asp.Net中发布页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友,

我从输入表单中获取很少的数据并将其插入到表格中.
插入后,我想从C#中完全发布页面.

我的编码如下:

Dear Friends,

I am getting few data from input form and inserting into a table.
After inserting I want to completely post the page from C#.

I have coded as below:

//Since I have used Update Panel - For Alert i have used ScriptManager.RegisterClientScriptBlock.
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "clientscript", "alert('Your details have successfully registered with us. Kindly check your mail inbox to login.')", true);
Response.Redirect("Opp_As_DSA.aspx");


它的工作,但警报消息未显示.
请在相同的位置上提出建议或指导我.


Its work but Alert Message is not dispalyed.
Kindly Suggest or Guide me on the same.

推荐答案

代码运行正常.代码
The code is working perfectly. The code
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "clientscript", "alert('Your details have successfully registered with us. Kindly check your mail inbox to login.')", true);



实际上注册了javascript并不会将其触发.您需要找到其他从客户端显示警报的方法.由于您提供的信息很少,因此我不建议您更多.

接下来,由于要使用



actually registers the javascript and does not fire it. You need to find other way to display the alert from client side. I can not suggest you more on this since you have provided a very little information on this.

Nextly, since you are redirecting the page using

Response.Redirect("Opp_As_DSA.aspx");

,由于重定向,警报将显示并且对您不可见.

, the alert will be displayed and not visible to you because of the redirection.


它可以很好地满足我的要求,但我不知道天气是使用它的正确方法.

Its work fine for my requirement but I don''t know weather it is proper way of using it.

ScriptManager.RegisterStartupScript(Page, Page.GetType(), "MessageThenRedirect", "alert(''Failure Report - Try Later.'');window.location=''Opp_As_DSA.aspx'';", true);


只需在.cs页中的insert语句之后使用此打击脚本

Just Use this blow script after the insert Statement in .cs page

Page.RegisterStartupScript(@"SubmitRegistration", "<script>alert('Your details have successfully registered with us. Kindly check your mail inbox to login')</script>");


这篇关于警报并在Asp.Net中发布页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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