test.aspx.cs

来自「《圣殿祭司的ASP.NET 2.0开发详解——使用C#》光盘内容.包含了书籍所含」· CS 代码 · 共 59 行

CS
59
字号
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;

public partial class Test : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
		/*
		// Define the array name and values.
		String arrName = "MyArray";
		String arrValue = "\"1\", \"2\", \"text\"";

		// Define the hidden field name and initial value.
		String hiddenName = "MyHiddenField";
		String hiddenValue = "3";

		// Define script name and type.
		String csname = "ConcatScript";
		Type cstype = this.GetType();

		// Get a ClientScriptManager reference from the Page class.
		ClientScriptManager cs = Page.ClientScript;

		// Register the array with the Page class.
		cs.RegisterArrayDeclaration(arrName, arrValue);

		// Register the hidden field with the Page class.
		cs.RegisterHiddenField(hiddenName, hiddenValue);

		// Check to see if the  script is already registered.
		if (!cs.IsClientScriptBlockRegistered(cstype, csname))
		{
			StringBuilder cstext = new StringBuilder();
			cstext.Append("<script type=text/javascript> function DoClick() {");
			cstext.Append("Form1.Message.value='Sum = ' + ");
			cstext.Append("(parseInt(" + arrName + "[0])+");
			cstext.Append("parseInt(" + arrName + "[1])+");
			cstext.Append("parseInt(" + Form1.Name + "." + hiddenName + ".value));} </");
			cstext.Append("script>");
			cs.RegisterClientScriptBlock(cstype, csname, cstext.ToString(), false);
		}
		 * */





    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?