How to handle each day of an independent calendar (ASP.net)

0

I have a Calendar object in my web application (ASP.NET 4.5.2), where I get the dates registered in the database and fill in the day of the calendar with a color, as shown below:

Iwasabletodoallthispartofgettingtheinformationfromthedatabaseandfillinginthecalendarusingthecodebelow.

PasteDBinfo:

protectedvoidCarregar_Eventos_Calendario(){DateTimedataSistema;conexao.Open();MySqlCommandcomando=conexao.CreateCommand();comando.CommandType=CommandType.Text;comando.CommandText=@"SELECT tec.descricaoTipoEvento, ec.descricaoEvento, ec.resumoEvento, ec.dataEvento
                                FROM eventosCalendario ec
                                INNER JOIN tipoEventosCalendario tec ON ec.idTipoEventoCalendario = tec.idTipoEventoCalendario
                                ORDER BY ec.dataEvento ASC";
        comando.ExecuteNonQuery();
        DataTable dt = new DataTable();
        MySqlDataAdapter da = new MySqlDataAdapter(comando);
        da.Fill(dt);
        foreach (DataRow dr in dt.Rows)
        {
            dataSistema = (DateTime)dr["dataEvento"];
            diasEventos.Add(dataSistema);
        }

        conexao.Close();
    }

Fill in the Calendar information (using DayRender):

protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
    {
        if (diasEventos.Contains(e.Day.Date) == true)
        {
            e.Cell.BackColor = Color.Black;
            e.Cell.ForeColor = Color.White;
        }
    }

As the table example, I would need to color the days according to the event type, for example:

CTB event = red color

Event Instructor Course = blue color

Could someone give me a light to achieve this?

    
asked by anonymous 16.05.2018 / 20:51

0 answers