问题
Below is my Markup page code of the ASPxDateEdit control:
<dx:ASPxDateEdit
ID="txtDateTime" runat="server" Width="100px" EditFormat="Date"
AllowNull="true" EditFormatString="dd-MMM-yyyy" MinDate="01-Jan-0001" OnDateChanged="txtDateTime_DateChanged"/>
And Here is the code behind of handling the OnDateChanged event
protected void txtDateTime_DateChanged(object sender, EventArgs e)
{
//code on handling onDateChanged event
}
My problem is that the OnDateChanged event isn't firing, why this case happens?
I solved this problem yesterday, thanks for everyone's help Answer: What I want to do is a client side event, but what I did is a server side event, so I solved this problem by putting a "AutoPostBack="True"" to it
回答1:
If it is a postback you are trying to achieve set the ASPxDateEdit.AutoPostBack true. The ASPxDateEdit does not postback data automatically.
<dx:ASPxDateEdit
ID="txtDateTime" runat="server" Width="100px" EditFormat="Date"
AllowNull="true" EditFormatString="dd-MMM-yyyy" MinDate="01-Jan-0001"
AutoPostBack="True"
OnDateChanged="txtDateTime_DateChanged"/>
If it is a callback (from a callback panel) then you might be trying to change things outside the callback panel, which won't happen as the callback is essentialy an ajax call.
For more info look here. It states that the Event is dependent on the AutoPostBack property.
来源:https://stackoverflow.com/questions/16975577/devexpress-aspxdateedit-control-ondatechanged-event-not-firing