4
I am creating a table and I need the columns to be created as follows: Mon, 23 Nov | Tue,24 Nov | Wed,25 Nov | Thu,26 Nov | Fri,27 Nov | Sat,28 Nov | Sun, 29 Nov
To create the Table I pass a date parameter (which is selected through a calendar)
I’m doing so to create the Table:
DateTime diaAgenda = 'Data que foi selecionada no calendario';
public DataTable gerarAgenda(DateTime dia)
{
DataTable tabela = new DataTable();
string diahoje = String.Format("{0:ddd, MMM d, yyyy}", dia);
tabela.Columns.Add("" + diahoje);
for (int data = 1; data < 7; data++)
{
dia = dia.AddDays(1);
diahoje = String.Format("{0:ddd, MMM d, yyyy}", dia);
tabela.Columns.Add("" + diahoje);
}
return tabela;
}
Making this way the table I Gero gets the following columns:
Thu,26 Nov | Fri,27 Nov | Sat,28 Nov | Sun, 29 Nov | Mon, 30 Nov | Tue,01 Dec | Wed,02 Dec |
How could I do to create the columns like this:
Mon, 23 Nov | Tue,24 Nov | Wed,25 Nov | Thu,26 Nov | Fri,27 Nov | Sat,28 Nov | Sun, 29 Nov
Your question is very confusing. Why can’t you make the first column second?
– Jéf Bueno
because I don’t know how to set that week always start on Monday..
– Tozzi
What is the parameter for
dia
? You are generating a table based on it?– Jéf Bueno
Bad question generates bad answers :)
– Maniero
Really @bigown. You saw that
switch-case
in the second answer? Is it the case to vote to close as is not clear enough?– Jéf Bueno
@jbueno the parameter I pass the day..
– Tozzi
This I noticed by its name. The question is: what is the parameter for?
– Jéf Bueno
I edited the question. It became clearer?
– Tozzi