search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

e.Value not passed on first eventclick after page load

Asked by Al
11 years ago.

Greetings...

I am implementing the DayPilotMonth control and want to say that you guys have done quite nice work with this control. However, I am running into a bit of an issue and am not sure if I may need to correct something on my end so was hoping for some insight.

When using postback to handle the eventclick, the e.Value is not being passed through the first time around and this happens only after initial page load. In other words, if I click on an event a second time and all subsequent times, the ID value is passed as expected. If I reload the page, I don't get the e.Value on the first event click but do get it again on all subsequent event clicks. I have bound the data on page load event as well with hopes that this may fix my problem but to no avail. Any thoughts?

Let me know if I need to further clarify...
Cheers,

Al

Comment posted by Al
11 years ago.

I have to append to my initial post...

The problem is a bit bigger because not only does it not pass through the e.Value as mentioned in original post but when there are multiple events, it does not clear the previous event's e.value when another event is clicked immediately after. In other words, I click on event 1 after initial page load and I get no e.Value passes. I click on event 1 a second time and I get e.Value (i.e. e.Value = 1). Then, click on event 2 and I still get e.Value = 1 despite the fact that the ID for event 2 is actually 2. If I click on event 2 a second time, then I get the correct e.Value.

Please, help if possible as I am in midst of a project and need some feedback quickly...

Thanks in advance.
Cheers,

Al

Answer posted by Al
11 years ago.

It looks like the issue was the UpdatePanel for some reason... Any thoughts why? Once I removed that and the DayPilot Month control wasn't wrapped inside it, the postback e.Value was passed through correctly each time.
Cheers,

Al

Comment posted by Dan Letecky [DayPilot]
11 years ago.

Al,

The mechanism that the UpdatePanel uses is quite transparent, at least from the point of view of the controls inside it. It hooks __doPostBack calls and replaces them with a special logic. DayPilot just calls __doPostBack with the necessary parameters - the mechanism is exactly the same for full PostBack and partial PostBack (inside an UpdatePanel).

What's the version of DayPilot you are using?

Comment posted by Al
11 years ago.

Hi Dan... thanks for the response.

I am using DayPilotPro-6.9.2522. I was also a bit thrown off by the fact that the UpdatePanel made the difference as it shouldn't have any impact upon how the postback is handled for the controls inside it. On a related note and for what it's worth, I was using nested master pages so I tested this whole thing with a stand-alone page, but it still had the same problem with regards to the e.Value when it was being passed, whilst contained within an UpdatePanel.

As mentioned, when I removed the UpdatePanel the e.Value was coming through correctly on each EventClick. Hope this helps but please do let me know if I can supply any additional info as I would love to use an UpdatePanel and not have to postback the entire page...
Cheers,

Al

Comment posted by Dan Letecky [DayPilot]
11 years ago.

I'll try to reproduce it using a new project. But this looks really weird - like the parameters were delayed one event/click. I can't imagine how this would happen.

Is your project running on .NET Framework 4.0?

Comment posted by Al
11 years ago.

Hi again... Yes, I found it odd as well but couldn't put my finger as to the actual cause for the delay other than pinpointing it to the UpdatePanel. I am indeed working on a web site application targeted at .NET 4.0...
Cheers,

Al

Comment posted by Al
11 years ago.

Hi Dan... Just wanted to check in and see if you were able to identify the root cause of the problem with the UpdatePanel or have any thoughts on how to get around it. Awaiting your response at your convenience...
Cheers,

Al

Comment posted by Dan Letecky [DayPilot]
11 years ago.

Al, Sorry for the delay. I'm still working on it. I'll get back to you soon.

Comment posted by Dan Letecky [DayPilot]
11 years ago.

Hi Al, I haven't been able to reproduce the problem.

I'm using the following code:

Month.aspx
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" >
  <ContentTemplate>
    <DayPilot:DayPilotMonth
        ID="DayPilotMonth1" 
        runat="server" 
        DataEndField="AssignmentEnd"
        DataStartField="AssignmentStart" 
        DataTextField="TaskName" 
        DataValueField="AssignmentId" 
        OnEventClick="DayPilotMonth1_EventClick"
        EventClickHandling="PostBack"
    />
  </ContentTemplate>
</asp:UpdatePanel>
Month.aspx.cs
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DayPilotMonth1.DataSource = new DataManager().GetAssignments(DayPilotMonth1);
            DayPilotMonth1.DataBind();
        }
    }

    protected void DayPilotMonth1_EventClick(object sender, EventClickEventArgs e)
    {
        throw new Exception("e.value: " + e.Value);
    }

It works as expected. Please let me know if you find anything that might give different results.

Comment posted by Al
11 years ago.

Hi again Dan,

Thanks a bunch for looking into it. I will take a look through my code again and compare against your code segment.
Cheers,

Al

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.