本文介绍了确认框澄清的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我需要一点澄清.
当我使用以下代码进行确认时.
我收到确认框,但是那时候只有确认框可见.
网页的其他详细信息正在变白看不见.
您能帮忙吗

Hi
I need a small clarification.
When i use the below code for confirmation.
I am getting the confirmation box but that time only the confirmation box is visile.
Web page other details are becoming white can not see.
Could you please help

Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "script", "alert(''New Customer created Successfully'');", true);



谢谢



Thanks

推荐答案


void Page_Load(/*whatever args go here*/)
{
   //Add in all your other output here (basically put all your other code here)

   //Now add in the alert box
   Literal ScriptSection = new Literal();
   ScriptSection.Text = "<script lang=\"text/javascript\">alert('Hello world!');</script>";
   Page.Form.Controls.Add(ScriptSection);
   //For the above line you could also use any control on your page e.g. MyControl.Controls.Add 
}



Literal控件会输出与您设置的文本完全相同的文本-它绕过ASP.Net处理,基本上意味着您可以在代码中编写HTML.但是请注意,如果使用过多,这会使代码变得混乱!

希望这会有所帮助,
埃德


有用的链接:

jQuery.ready: http://api.jquery.com/ready/ [ ^ ]

MSDN文字控制: http://msdn.microsoft.com/zh-我们/library/system.web.ui.webcontrols.literal.aspx [ ^ ]



The Literal control outputs exactly whatever text you set it to - it bypasses ASP.Net processing basically meaning you can write HTML in your code. Be warned though, this makes code messy if used too much!

Hope this helps,
Ed


Useful links:

jQuery.ready : http://api.jquery.com/ready/[^]

MSDN Literal control : http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.literal.aspx[^]



这篇关于确认框澄清的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 23:41