2011-07-23 3 views
0
HtmlTable baseCalendar = new HtmlTable(); 
HtmlTableRow calendarRow = new HtmlTableRow(); 
HtmlTableCell calendarCell = new HtmlTableCell(); 

for (int i = 1; i < 7; i++) 
{ 
    calendarRow = new HtmlTableRow(); 

    for (int k = 0; k < 7; k++) 
    { 
     calendarCell = new HtmlTableCell(); 
     calendarRow.Cells.Add(calendarCell); 
    }  

    baseCalendar.Rows.Add(calendarRow);     
} 
//in this place how can add new row to first row of `baseCalendar` 

par exemple:Ajouter nouvelle ligne à la table

baseCalendar=" 
<table> 
    <tr id='row1'> 
     <td></td> 
     <td></td> 
    </tr> 
</table>" 

comment ajouter une nouvelle ligne befor row1

+0

Pourquoi êtes-vous créer un calendrier à la main quand il y a des contrôles qui le font déjà? Juste curieux. – TheGeekYouNeed

+0

pour le calendrier persan – ashkufaraz

+0

@GodIsLive pourquoi voulez-vous ajouter la rangée supérieure à la fin de tout le traitement? – NoviceProgrammer

Répondre

0

Vous pouvez utiliser la méthode Insert, comme ceci:

... 
HtmlTableRow headers = new HtmlTableRow(); 
headers.Cells.Add(new HtmlTableCell("sat")); 
... 

baseCalendar.Rows.Insert(1, headers); 
Questions connexes