c# - A table with advanced features -


i have big need , hope here have sympathy , time answer me ;).

two weeks ago in training , i'm trying add functionality datatable. thinking of using jquery implementation.

here example of have currently:

tableau

i constructed table c# in code behind file. told use gridview or datagrid cells in table have feature may not compatible gridview or datagrid. in fact, add each 1 cell specifying attribute "class" , "rowspan / colspan" when necessary. , not know if possible gridview or datagrid. need these multiple "class" treated cells jquery (note: able drag & drop).

here of code shows how create table:

aspx code.:

<asp:table id="tabg" runat="server" gridlines="both">  <asp:tableheaderrow id="tableheaderrow1" runat="server" tablesection="tableheader">                             <asp:tablecell id="idtitretabg_checkb" rowspan="3"></asp:tablecell>                             <asp:tablecell id="idtitretabg_numof" rowspan="2">                                 <asp:label id="lbtabg_titrenumof" text="n° of" runat="server"></asp:label> <br />                             </asp:tablecell>                             <asp:tablecell rowspan="2">                                 <asp:label id="lbtabg_titreseqof" text="seq of" runat="server"></asp:label> <br />                             </asp:tablecell>                             <asp:tablecell rowspan="2">                                 <asp:label id="lbtabg_titreart" text="article" runat="server"></asp:label> <br />                             </asp:tablecell>                             <asp:tablecell rowspan="2">                                 <asp:label id="lbtabg_titreqteprevue" text="qté of prévue" runat="server"></asp:label> <br />                             </asp:tablecell>                             <asp:tablecell rowspan="2">                                 <asp:label id="lbtabg_titreqterevue" text="qté of revue" runat="server"></asp:label> <br />                             </asp:tablecell>                             <asp:tablecell rowspan="2">                                 <asp:label id="lbtabg_titrecomp" text="composant" runat="server"></asp:label> <br />                             </asp:tablecell>                             <asp:tablecell rowspan="2">                                 <asp:label id="lbtabg_titrerestant" text="restant à assigner" runat="server"></asp:label> <br />                             </asp:tablecell>                             <asp:tablecell columnspan="3">                                 <asp:label id="lbtabg_titreassignhu" text="assignation hu" runat="server"></asp:label>                             </asp:tablecell>                         </asp:tableheaderrow>                          <asp:tableheaderrow id="tableheaderrow2" runat="server" tablesection="tableheader">                             <asp:tablecell>                                 <asp:label id="lbtabg_titreqtetotale" text="qté totale" runat="server"></asp:label> <br />                             </asp:tablecell>                             <asp:tablecell>                                 <asp:label id="lbtabg_titrenumhu" text="n° hu" runat="server"></asp:label> <br />                             </asp:tablecell>                             <asp:tablecell>                                 <asp:label id="lbtabg_titreqte" text="quantité" runat="server"></asp:label> <br />                             </asp:tablecell>                         </asp:tableheaderrow>                          <asp:tableheaderrow id="tableheaderrow5" runat="server" tablesection="tableheader">                             <asp:tablecell>                                 <asp:imagebutton id="ibtabg_titrenumof_fleche" runat="server" postbackurl="~/test.aspx?nomcolg=cod_wo&order=desc" imageurl="~/images/bas.jpg" />                             </asp:tablecell>                             <asp:tablecell>                                 <asp:imagebutton id="ibtabg_titreseqof_fleche" runat="server" postbackurl="~/test.aspx?nomcolg=dat_sequence&order=desc" imageurl="~/images/bas.jpg" />                             </asp:tablecell>                             <asp:tablecell>                                 <asp:imagebutton id="ibtabg_titreart_fleche" runat="server" postbackurl="~/test.aspx?nomcolg=article&order=desc" imageurl="~/images/bas.jpg" />                             </asp:tablecell>                             <asp:tablecell>                                 <asp:imagebutton id="ibtabg_titreqteprevue_fleche" runat="server" postbackurl="~/test.aspx?nomcolg=wo_qty&order=desc" imageurl="~/images/bas.jpg" />                             </asp:tablecell>                             <asp:tablecell>                                 <asp:imagebutton id="ibtabg_titreqterevue_fleche" runat="server" postbackurl="~/test.aspx?nomcolg=qty_revue&order=desc" imageurl="~/images/bas.jpg" />                             </asp:tablecell>                             <asp:tablecell>                                 <asp:imagebutton id="ibtabg_titrecomposant_fleche" runat="server" postbackurl="~/test.aspx?nomcolg=composant&order=desc" imageurl="~/images/bas.jpg" />                             </asp:tablecell>                             <asp:tablecell>                                 <asp:imagebutton id="ibtabg_titrerestant_fleche" runat="server" postbackurl="~/test.aspx?nomcolg=restant_a_assigner&order=desc" imageurl="~/images/bas.jpg" />                             </asp:tablecell>                             <asp:tablecell>                             </asp:tablecell>                             <asp:tablecell>                             </asp:tablecell>                             <asp:tablecell>                             </asp:tablecell>                          </asp:tableheaderrow>  </asp:table> 

this section creates headers of columns

behind c # code completes table:

protected void settabassignationof(oracleconnection oconnexion, string reqof)         {              oraclecommand cmd = new oraclecommand(reqof);             cmd.connection = oconnexion;              oracledatareader reader = cmd.executereader();              int cpt = 0;             int nblignescurrentof = 0;             int numligne = 0;             string idcurrentof = "";              list<tablerow> lignes = new list<tablerow>();              while (reader.read())             {                  tablerow nouvelleligne = new tablerow();                  checkbox controlcb = new checkbox();                 tablecell checkb = new tablecell();                 tablecell numof = new tablecell();                 tablecell seqof = new tablecell();                 tablecell art = new tablecell();                 tablecell qteprevue = new tablecell();                 tablecell qterevue = new tablecell();                 tablecell composant = new tablecell();                 tablecell restant = new tablecell();                 tablecell qtetotale = new tablecell();                 tablecell numhu = new tablecell();                 tablecell qtehu = new tablecell();                  if(reader.getvalue(0).tostring() == idcurrentof){                     tablerow lignemodifie = new tablerow();                      nblignescurrentof = nblignescurrentof + 1;                      lignes[numligne].cells[0].rowspan = nblignescurrentof;                     lignes[numligne].cells[1].rowspan = nblignescurrentof;                     lignes[numligne].cells[2].rowspan = nblignescurrentof;                     lignes[numligne].cells[3].rowspan = nblignescurrentof;                     lignes[numligne].cells[4].rowspan = nblignescurrentof;                     lignes[numligne].cells[5].rowspan = nblignescurrentof;                     lignes[numligne].cells[6].rowspan = nblignescurrentof;                     lignes[numligne].cells[7].rowspan = nblignescurrentof;                       // nouvelles lignes                     string identifiant = lignes[numligne].cells[1].id;                      qtetotale.text = reader.getvalue(9).tostring();                     qtetotale.attributes.add("class", "tabg_qtetotale donneesof " + lignes[numligne].cells[1].text);                     qtetotale.attributes.add("value", qtetotale.text);                     qtetotale.id = "qtet" + identifiant + "_" + nblignescurrentof;                      numhu.text = reader.getvalue(10).tostring();                     numhu.attributes.add("class", "tabg_numhu donneesof " + lignes[numligne].cells[1].text + " " + numhu.text.replace(" ", "_"));                     numhu.attributes.add("value", numhu.text);                     numhu.id = "numhu" + identifiant + "_" + nblignescurrentof;                     numhu.attributes.add("onclick", "onclick_cellule(\"" + numhu.text + "\",\"" + numhu.text.replace(" ", "_") + "\");");                      qtehu.text = reader.getvalue(11).tostring();                     qtehu.attributes.add("class", "tabg_qtehu donneesof " + lignes[numligne].cells[1].text);                     qtehu.attributes.add("value", qtehu.text);                     qtehu.id = "qteh" + identifiant + "_" + nblignescurrentof;                      nouvelleligne.cells.add(qtetotale);                     nouvelleligne.cells.add(numhu);                     nouvelleligne.cells.add(qtehu);                      lignes.add(nouvelleligne);                 }                 else{                     numligne = numligne + nblignescurrentof;                     nblignescurrentof = 1;                      idcurrentof = reader.getvalue(0).tostring();                      // la premiere colonne contient une checkbox avec le numéro de l'of                     checkb.id = "cb" + reader.getvalue(0).tostring() + cpt;                     checkb.controls.add(controlcb);                     checkb.attributes.add("class", "tabg_checkb donneesof " + reader.getvalue(0).tostring());                     checkb.attributes.add("value", "n");                      // les colonnes suivantes                     numof.text = reader.getvalue(0).tostring();                     numof.attributes.add("class", "tabg_numof donneesof " + numof.text + " " + numof.text.replace(" ","_"));                     numof.attributes.add("value", numof.text);                     numof.id = numof.text;                     numof.attributes.add("onclick", "onclick_cellule(\"" + numof.text + "\",\"" + numof.text.replace(" ","_") + "\");");                      seqof.text = reader.getvalue(3).tostring();                     seqof.attributes.add("class", "tabg_seqof donneesof " + numof.text);                     seqof.attributes.add("value", seqof.text);                     seqof.id = "seqof" + numof.id;                      art.text = reader.getvalue(4).tostring();                     art.attributes.add("class", "tabg_art donneesof " + numof.text);                     art.attributes.add("value", art.text);                     art.id = "art" + numof.id;                      qteprevue.text = reader.getvalue(5).tostring();                     qteprevue.attributes.add("class", "tabg_qteprevue donneesof " + numof.text);                     qteprevue.attributes.add("value", qteprevue.text);                     qteprevue.id = "qtep" + numof.id;                      qterevue.text = reader.getvalue(6).tostring();                     qterevue.attributes.add("class", "tabg_qterevue donneesof " + numof.text);                     qterevue.attributes.add("value", qterevue.text);                     qterevue.id = "qter" + numof.id;                      composant.text = reader.getvalue(7).tostring();                     composant.attributes.add("class", "tabg_composant donneesof " + numof.text + " " + composant.text.replace(" ","_"));                     composant.attributes.add("value", composant.text);                     composant.id = "comp" + numof.id;                     composant.attributes.add("onclick", "onclick_cellule(\"" + composant.text + "\",\"" + composant.text.replace(" ","_") + "\");");                      restant.text = reader.getvalue(8).tostring();                     restant.attributes.add("class", "tabg_restant donneesof " + numof.text);                     restant.attributes.add("value", restant.text);                     restant.id = "restant" + numof.id;                      qtetotale.text = reader.getvalue(9).tostring();                     qtetotale.attributes.add("class", "tabg_qtetotale donneesof " + numof.text);                     qtetotale.attributes.add("value", qtetotale.text);                     qtetotale.id = "qtet" + numof.id + "_1";                      numhu.text = reader.getvalue(10).tostring();                     numhu.attributes.add("class", "tabg_numhu donneesof " + numof.text + " " + numhu.text.replace(" ", "_"));                     numhu.attributes.add("value", numhu.text);                     numhu.id = "numhu" + numof.id + "_1";                     numhu.attributes.add("onclick", "onclick_cellule(\"" + numhu.text + "\",\"" + numhu.text.replace(" ","_") + "\");");                      qtehu.text = reader.getvalue(11).tostring();                     qtehu.attributes.add("class", "tabg_qtehu donneesof " + numof.text);                     qtehu.attributes.add("value", qtehu.text);                     qtehu.id = "qteh" + numof.id + "_1";                      nouvelleligne.cells.add(checkb);                     nouvelleligne.cells.add(numof);                     nouvelleligne.cells.add(seqof);                     nouvelleligne.cells.add(art);                     nouvelleligne.cells.add(qteprevue);                     nouvelleligne.cells.add(qterevue);                     nouvelleligne.cells.add(composant);                     nouvelleligne.cells.add(restant);                     nouvelleligne.cells.add(qtetotale);                     nouvelleligne.cells.add(numhu);                     nouvelleligne.cells.add(qtehu);                      lignes.add(nouvelleligne);                 }                    cpt++;             }              (int = 0; < lignes.count; i++)             {                 tabg.rows.add(lignes[i]);             }         } 

as can see, each cell has many attribute "class" or "rowspan". system, checkbox not related lines, means if example check checkbox in row 3 , made sort on column 2. checkbox on line 3 checked no longer correspond same line.

i advice on following: think there solution, method should use? know jquery plugin can make things ? in advance.

it's not free but, have @ devexpress's gridview. make life lot simplier. can use control library telerik, jeasyui, etc. happen have worked them , manipulate large amounts of data graphically these libraries save alot of time.

devexpress's grid can handle dnd features on own has has traditionnal selection. think require work achieve selection behavior have right now.

(i tought go automaticaly has comment, hey! guess not.)


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -