Solved

Call the DayRender Event

Posted on 2011-03-12
4
1,872 Views
Last Modified: 2012-05-11
I am using the Dayrender event to make certain days unselectable.

When the user selects a different calendar month, the disabled days become enabled.

I believe that I need to call the dayrender event from the SelectionChanged event.

protected void calToDate_SelectionChanged(object sender, EventArgs e)
        {
             //Call the dayrender event
             What is the code to do this?

---
This works, I just need to call it from the  calToDate_SelectionChanged procedure.
protected void calToDate_DayRender(object source, DayRenderEventArgs e)
    {
        int intToMonth = dteCalToDate.Month;
        int intToDay = (dteCalToDate.Day + 1);
        if (e.Day.Date.Day >= intToDay && e.Day.Date.Month == intToMonth)
        {
            e.Cell.Controls.Clear();
            e.Cell.Text = e.Day.DayNumberText;
            e.Cell.BackColor = System.Drawing.Color.Orange;
        }

Thanks,
0
Comment
Question by:Dovberman
  • 3
4 Comments
 
LVL 13

Expert Comment

by:agarwalrahul
ID: 35115585
0
 

Assisted Solution

by:Dovberman
Dovberman earned 0 total points
ID: 35118090
protected void calToDate_SelectionChanged(object sender, EventArgs e)
        {
             //Call the dayrender event
             What does the following code do?
             I does not call the calToDate_DayRender procedure .
             calToDate.DayRender += new DayRenderEventHandler(this.calToDate_DayRender);
             What am I missing?          


This works, I just need to call it from the  calToDate_SelectionChanged procedure.
protected void calToDate_DayRender(object source, DayRenderEventArgs e)





0
 

Accepted Solution

by:
Dovberman earned 0 total points
ID: 35123209
The dayrender event cannot be called directly.

This event is fired when the web page is loaded.

You can however call the page load event.

protected void calFromDate_VisibleMonthChanged(Object sender, MonthChangedEventArgs e)
    {
        // Causes the calendar to be rendered when the month is changed
        this.Load += this.Page_Load;
        refPrintGrid.Visible = true;
    }

0
 

Author Closing Comment

by:Dovberman
ID: 35163482
I found the solution myself.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
A short film showing how OnPage and Connectwise integration works.
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now