您的位置:首页 > 其它

Serializer for dynamic control

2008-06-19 23:59 225 查看
using System;

using System.IO;

using System.Collections;

using System.Runtime.Serialization.Formatters.Binary;

using System.Runtime.Serialization;

using System.Web;

using System.Text;

public class Serializer

using System;

using System.Configuration;

using System.Data;

using System.Linq;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.HtmlControls;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Xml.Linq;

using System.Collections;

using System.IO;

using System.Text;

public partial class _Default : System.Web.UI.Page

{

#region "OnInit"

protected override void OnInit(EventArgs e)

{

//base.OnInit(e);

//string inform = Request.Form[hfHolder.ClientID];

//if (!string.IsNullOrEmpty(inform))

//{

// string[] array = inform.Split(';');

// string type = array[0];

// string id = array[1];

// if (type == "TextBox")

// {

// TextBox tb = new TextBox();

// tb.ID = id;

// PlaceHolder1.Controls.Add(tb);

// }

//}

}

#endregion

protected void Page_Load(object sender, EventArgs e)

{

if (!string.IsNullOrEmpty(hfHolder.Value))

{

Hashtable h = Serializer.WebDeserialize(hfHolder.Value) as Hashtable;

Response.Write(h["test"].ToString());

}

}

protected void Button1_Click(object sender, EventArgs e)

{

//if (string.IsNullOrEmpty(hfHolder.Value))

//{

// TextBox tb = new TextBox();

// tb.ID = "test";

// PlaceHolder1.Controls.Add(tb);

// hfHolder.Value = "TextBox;test";

//}

}

protected void Button2_Click(object sender, EventArgs e)

{

Hashtable h = new Hashtable();

h.Add("test", "007");

hfHolder.Value = Serializer.WebSerialize(h);

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐