Thank you for your quick reply! But my code it's different and I don't know
what to do! Please, help me again! Thank you a lot!
Here is my code
==============================================
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataGrid DataGrid1;
protected System.Web.UI.WebControls.Calendar Calendar1;
protected DataSet dsHoliday = new DataSet("holiday");
private void Page_Load(object sender, System.EventArgs e)
{
dsHoliday.ReadXml("s://home/zabeo/web/calendario/holidays.xml");
DataGrid1.DataSource = dsHoliday;
DataGrid1.DataMember = "holiday";
DataGrid1.DataBind();
// Put user code to initialize the page here
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Calendar1.DayRender += new
System.Web.UI.WebControls.DayRenderEventHandler(th is.Calendar1_DayRender);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Calendar1_DayRender(object sender,
System.Web.UI.WebControls.DayRenderEventArgs e)
{
DataGrid1.DataSource = dsHoliday;
e.Day.IsSelectable = false;
foreach (DataRow myDataRow in dsHoliday.Tables["holiday"].Rows)
{
string s = myDataRow["Date"].ToString();
string c = myDataRow["Cor"].ToString();
string d = myDataRow["Description"].ToString();
DateTime holiday_date = DateTime.Parse(s);
Style holidayStyle = new Style();
holidayStyle.BorderWidth = 1;
holidayStyle.Font.Bold = true;
holidayStyle.BorderColor =
System.Drawing.ColorTranslator.FromHtml("#"+c+"");
holidayStyle.ForeColor =
System.Drawing.ColorTranslator.FromHtml("#000000") ;
if ((e.Day.Date == holiday_date) && (!e.Day.IsOtherMonth))
{
e.Cell.ApplyStyle(holidayStyle);
e.Day.IsSelectable = true;
}
}
}
}
}
==============================================
"Mark Rae [MVP]" wrote:
"Adriana" <Ad*****@discussions.microsoft.comwrote in message
news:E4**********************************@microsof t.com...
[top-posting corrected]
>if (e.Day.Date == dt)
{
e.Cell.Text = row["day"].ToString() + "<br/>" +
row["message"].ToString().Trim();
}
The second event always replaces the first event, so in the calendar
control it only displays the one event. Any help on how to get the
calendar control to display both events will be appreciated.
You are setting the e.cell.text to a value which will overlay any
previous entries. On each entry for a day you need to concatonate the
value. You will have to check if any entries are already there and if
they are concatonate rather than just setting the value.
I'm having the same issue to solve!
Could you, please, show an example?
if (e.Day.Date == dt)
{
e.Cell.Text += row["day"].ToString() + "<br />" +
row["message"].ToString().Trim() + <br /><br />;
}
Notice also <br /instead of <br/>
--
Mark Rae
ASP.NET MVP
http://www.markrae.net