ASP.NET(c#) MesageBox JS Alert and Other Debug tools

MesageBox JS Alert

 string script = "alert('New Password is Created');\n";


                Page.ClientScript.RegisterStartupScript(GetType(), "msgbox", script, true);
****************************************************************************************************************************************************************************************
計算程序運行時間:

using System.Diagnostics;

private Stopwatch stw = new Stopwatch();

private void Form1_Load(object sender, EventArgs e)
{
stw.Start();
}

private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
DialogResult dr = MessageBox.Show("真的要退出?", "退出", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (dr == DialogResult.Yes)
{
stw.Stop();
MessageBox.Show("程序共運行時間:" + stw.Elapsed.Seconds.ToString() + "." + stw.Elapsed.Milliseconds.ToString() + "秒");
e.Cancel = false;
}
else
{
e.Cancel = true;
}
}

**************************************************************************************************************************************************************************************

Debug Output in the class

1, go to Debug --> options & Setting --> Redirect all output Window text to the Immediate window

System.Diagnostic.Debug.WriteLine("stuff");




**************************************************************************************************************************************************************************************

如何增加一些非.net控件的屬性: 以Ifream爲例子

http://stackoverflow.com/questions/3945176/talking-to-iframe-from-asp-net-code-behind

MyIframe.Attributes.Add("src", "http://www.facebook.com");

*************************************************************************************************************************************************************************************


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章