jQuery结合asp.net生成页表

 

protected void Page_Load(object sender, EventArgs e)
        {
            Literal1.Text = "<ul id=Gid>";

            for (int i = 0; i < GetGroups().Count; i++)
            {
                Literal1.Text += @"<li><a href=#fragment-" + i + "><span>" + GetGroups()[i] + "</span></a></li>";
            }
            Literal1.Text += "</ul>";

                    

            for (int i = 0; i < GetGroups().Count; i++)
            {
                Literal1.Text += @"<div id=fragment-" + i + "><TABLE id=Tid border=0 cellspacing=0 cellpadding=0 class=flora>";
                Literal1.Text += @"<TR>";
                for (int j = 1; j < GetDetail().Count+1; j++)
                {
                    Literal1.Text += @"<TD >" + GetDetail()[j - 1];
                    Literal1.Text += @"</TD>";
                   

                    if (j % GetRepeats() == 0)
                    {
                        Literal1.Text += @"</TR><TR>";
                    }
                }
                Literal1.Text += @"</TR></TABLE></div>";
            }

        }

        public List<string> GetGroups()
        {
            List<string> Groups = new List<string>();

            for (int i = 0; i < 3; i++)
            {
                Groups.Add("测试组" + i.ToString());
            }

            return Groups;

        }

        public List<string> GetDetail()
        {
            List<string> Details = new List<string>();

            for (int i = 0; i < 7; i++)
            {
                Details.Add("名称:" + i.ToString() + "<INPUT TYPE=text NAME=T" + i + " ID=T" + i + " height=1 runat=server value=" + System.Guid.NewGuid().ToString().Substring(0, 5) + ">");
            }

            return Details;

        }

       

        public int GetRepeats()
        {
            return 2;
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
        
            Response.Write(Request.Params["T1"].ToString());

         }

posted @ 2008-10-14 11:28  昕友软件开发  阅读(301)  评论(0编辑  收藏  举报
欢迎访问我的开源项目:xyIM企业即时通讯