HTML Dynamic Table

Source: Internet
Author: User

1<table id="OPTTB">2<asp:repeater id="tempoptions"runat="Server">3<ItemTemplate>4<tr ondblclick="tt (this)">5<td><% #Eval ("XH")%></td>6<td><% #Eval ("XXBH")%></td>7<td><% #Eval ("XXMC")%></td>8<td><% #Eval ("ISOK")%></td>9</tr>Ten</ItemTemplate> One</asp:Repeater> A</table>
View Code

HTML Dynamic Table background

1 protected voidDeloption_click (Objectsender, EventArgs e)2 {3 varTemplist =NewList<tablemodel>();4 varDelno = This. Delno.value;5 if(session["tempdate"] !=NULL)6 {7 varTempdata1 = session["tempdate"] asList<tablemodel>;8 9  for(inti =0; I < Tempdata1. Count; i++)Ten { One templist. ADD (Tempdata1[i]); A } - } -Templist. RemoveAt (Convert.ToInt16 (delno.substring (0,1))); the  - list. Clear (); -  -  for(intK =0; K < Templist. Count; k++) + { -TableModel TM =NewTableModel (); +Tm.xh =k.tostring (); ATm. XXBH =Numtochar (k.tostring ()); atTm. XXMC =Templist[k]. XXMC; -Tm. ISOK =Templist[k]. ISOK; -Tm. Remark =Templist[k]. Remark; - list. ADD (tm); - } -  in  This. Tempoptions.datasource =todatatable (list); - Tempoptions.databind (); to templist. Clear (); + list. Clear (); -  the } *  $ Panax Notoginseng  -   protected voidAddoption_click (Objectsender, EventArgs e) the         { +             if(session["tempdate"] !=NULL) A             { the                 varTempdata1 = session["tempdate"] asList<tablemodel>; +                  for(inti =0; I < Tempdata1. Count; i++) -                 { $ list. ADD (Tempdata1[i]); $                 } -             } -TableModel TM =NewTableModel (); theTm.xh =(list. Count). ToString (); -Tm. XXBH =Numtochar (TM.XH);WuyiTm. XXMC = This. Questions.text; theTm. ISOK = This. ISOK1. Checked = =true?"No":"is a"; -Tm. Remark = This. Remark.text; Wu             vartt =ISOK2. Checked; - list. ADD (tm); About              This. Tempoptions.datasource =todatatable (list); $ Tempoptions.databind (); -session["tempdate"] =list; - list. Clear (); -         } A  +  the  -  $   Public StaticDataTable todatatable (IList list) the         { theDataTable result =NewDataTable (); the             if(list. Count >0) the             { -propertyinfo[] Propertys = list[0]. GetType (). GetProperties (); in                 foreach(PropertyInfo Piinchpropertys) the                 { the result. Columns.Add (pi. Name, Pi. PropertyType); About                 } the  the                  for(inti =0; I < list. Count; i++) the                 { +ArrayList templist =NewArrayList (); -                     foreach(PropertyInfo Piinchpropertys) the                     {Bayi                         Objectobj = pi. GetValue (List[i],NULL); the templist.add (obj); the                     } -                     Object[] Array =Templist.toarray (); -Result. Loaddatarow (Array,true); the                 } the             } the             returnresult; the}
View Code

HTML Dynamic Table

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.