Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Create Table within Cell
Message
De
20/05/2014 16:15:00
 
 
À
20/05/2014 15:44:10
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
ASP.NET
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01600342
Message ID:
01600346
Vues:
35
>This is C#, by the way
>
>I need to be able to create a table of tables.
>I can do it 'by hand' in HTML
>
>        asp:Table ID="ServerTable" runat="server" Width="100%"  Height="100%" CellSpacing="20" >
>           asp:TableRow>
>               asp:TableCell>
>                  asp:Table CssClass="HeatTableGreen" ID="Table2" runat="server" Height="100%" width="100%"  >
>                    asp:TableRow>
>                        asp:TableCell CssClass="HeatInfoCell" ID="SvrName1" HorizontalAlign="Center" >
>                            label>1</label>
>                        /asp:TableCell>
>                        asp:TableCell >
>                        /asp:TableCell>
>                        asp:TableCell  >
>                        /asp:TableCell>
>                    /asp:TableRow>   
>
>                    asp:TableRow>
>                        asp:TableCell  >
>                        /asp:TableCell>
>                        asp:TableCell CssClass="HeatInfoCell"  ID="SvrCount1" HorizontalAlign="Center" >
>                            <label>15</label> 
>                        /asp:TableCell>
>                        asp:TableCell  >
>                        /asp:TableCell>
>                    /asp:TableRow>     
>                  /asp:Table>  
>                /asp:TableCell>
>     etc
>     etc...
>
>
>There are 9 total of these in a 3x3 table and I think (note the hopeful use of that word) I've got the C# code
>
>           var HeatTable = new Table();
>            
>            
>            if ((i % 2) == 0)
>            {
>                HeatTable.CssClass = ".HeatTableGreen";
>            }
>            else
>            {
>                HeatTable.CssClass = ".HeatTableYellow";
>            }
>            HeatTable.ID = "HeatTable" + i.ToString();
>            for (int k = 0; k < 2; k++)    //Row counter in HeatTable
>            {
>                var HeatRow = new TableRow();
>                for (int j = 0; j < 3; j++)     //Col counter in HeatTable
>                {
>                    var HeatCell = new TableCell();
>                    switch (k)
>                    {
>                        case 0:
>                            if (j == 0)
>                            {
>                                //this is a HeatInfo cell
>                                HeatCell.Text = "1";  //replace with ServerName from table
>                                HeatCell.CssClass = ".HeatInfo";
>                            }
>                            break;
>                        case 1:
>                            if (j == 1)
>                            {
>                                //the other HeatInfo cell
>                                HeatCell.Text = "22";  //replace with CurrentTotalTasks
>                                HeatCell.CssClass = ".HeatInfo";
>                            }
>                            break;
>                        default:
>                            HeatCell.CssClass = "HeatCell";
>                            break;
>                    } //HeatCell
>                    HeatRow.Cells.Add(HeatCell);
>                }  //HeatRow
>                HeatTable.Rows.Add(HeatRow);
>            } //HeatTable
>        }
>        HeatFrameRow.Cells.Add(HeatFrameCell);
>        HeatFrame.Rows.Add(HeatFrameRow);
>
>
>But I have no flailing idea how to get this to show up on the page. When I run it, I get a blank page
>in the aspx I now have
>
>  div id="HTDIv">
>    asp:Table ID="HeatFrame" runat="server" GridLines="Both" >
>  /div
>
>
>What am I not doing?

Dunno. But what you are doing is confusing me :-}

You build up a table named 'HeatTable' then, suddenly, we have 'HeatFrame','HeatFrameRow' and 'HeatFrameCell'.
How do they fit in to the picture ?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform