Note that there are some explanatory texts on larger screens.

plurals
  1. POasp.net page not posting back, while the button click event is still firing
    text
    copied!<p>Okay, so I have this page, which has one <code>Ajax:AsyncFileUploader</code> also some other ajax stuff like <code>ModelPopUpExtender</code> etc. The problem is the two buttons in the page, of <code>Cancel</code> and <code>Submit</code>, both of them <strong>firing up</strong> but none is posting back, while I made sure none of the fields in the page are blank. </p> <p>I know the events are firing up, because I debugged the JavaScript in <code>Firebug</code> (a single step into and continue process took more than 4 min, while I was just almost held the F10 key for stepping into, down!) </p> <p>If anyone wants code, please tell me I'd post it, but buttons are just in normal code so nothing special, that's why I am not posting the code, but in case required I can post entire page's code (which is <strong>pretty long</strong> I'd tell you, not really though, but at least just for posting purpose in here, somewhat around 200 lines). Any help anyone?</p> <p><strong>Edit: As per comment I am posting the code</strong><br> <strong>code: aspx page</strong></p> <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %&gt; &lt;%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head runat="server"&gt; &lt;title&gt;Detailed Reminder&lt;/title&gt; &lt;link href="StyleSheets/Default.css" rel="stylesheet" type="text/css" /&gt; &lt;script type="text/javascript"&gt; function FileUploaded(sender, args) { var filename = args.get_fileName(); var contentType = args.get_contentType(); var text = "Size of " + filename + " is " + args.get_length() + " bytes"; if (contentType.length &gt; 0) { text += " and content type is '" + contentType + "'."; } $get('LabelStatusUpload').innerHTML = "File Uploaded Successfully"; } function UploadStarted(sender, args) { $get('LabelStatusUpload').innerHTML = "Upload Started"; } function ErrorUploaded(sender, args) { $get('LabelStatusUpload').innerHTML = "Some Error Occured"; } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="Form1" runat="server"&gt; &lt;ajax:ToolkitScriptManager ID="SM1" runat="server"&gt; &lt;/ajax:ToolkitScriptManager&gt; &lt;asp:Button ID="Temp1" runat="server" Text="clear" /&gt; &lt;div id="UpperContainer"&gt; &lt;asp:Panel ID="PanelOuter" runat="server"&gt; &lt;asp:Table ID="TableDetailedRemidner" runat="server"&gt; &lt;asp:TableRow ID="TableRowName" runat="server"&gt; &lt;asp:TableCell ID="TableCell1" runat="server"&gt; &lt;asp:Label ID="LabelName" runat="server" AssociatedControlID="txtName" Text="Name"&gt;&lt;/asp:Label&gt; &lt;/asp:TableCell&gt; &lt;asp:TableCell ID="TableCell2" runat="server"&gt; &lt;asp:TextBox ID="txtName" runat="server" ToolTip="Name of the user to send the mail to"&gt;&lt;/asp:TextBox&gt; &lt;/asp:TableCell&gt; &lt;/asp:TableRow&gt; &lt;asp:TableRow ID="TableRowEmail" runat="server"&gt; &lt;asp:TableCell ID="TableCell3" runat="server"&gt; &lt;asp:Label ID="LabelEmail" runat="server" AssociatedControlID="txtEmail1" Text="Email 1"&gt;&lt;/asp:Label&gt; &lt;/asp:TableCell&gt; &lt;asp:TableCell ID="TableCell4" runat="server"&gt; &lt;asp:TextBox ID="txtEmail" runat="server" Width="560px"&gt;&lt;/asp:TextBox&gt; &lt;asp:RegularExpressionValidator ID="regexEmailValidator" runat="server" ControlToValidate="txtEmail" Display="Dynamic" Text="Invalid Email" ValidationExpression="\w+([-+.’]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"&gt;&lt;/asp:RegularExpressionValidator&gt; &lt;/asp:TableCell&gt; &lt;/asp:TableRow&gt; &lt;asp:TableRow ID="TableRowSubject" runat="server"&gt; &lt;asp:TableCell ID="TableCell5" runat="server"&gt; &lt;asp:Label ID="LabelSubject" runat="server" AssociatedControlID="txtSubject" Text="Subject"&gt;&lt;/asp:Label&gt; &lt;/asp:TableCell&gt; &lt;asp:TableCell ID="TableCell6" runat="server"&gt; &lt;asp:TextBox ID="txtSubject" runat="server" AutoComplete="off" Width="560px"&gt;&lt;/asp:TextBox&gt; &lt;asp:Panel ID="PanelDefaultSubjects" runat="server"&gt; &lt;div&gt; &lt;asp:UpdatePanel ID="UpdatePanelSubject" runat="server"&gt; &lt;ContentTemplate&gt; &lt;asp:RadioButtonList ID="RadioSubjectList" runat="server" AutoPostBack="true" OnSelectedIndexChanged="RadioSubjectList_SelectedIndexChanged"&gt; &lt;asp:ListItem Text="Submit the reports"&gt;&lt;/asp:ListItem&gt; &lt;asp:ListItem Text="prepare the presentation"&gt;&lt;/asp:ListItem&gt; &lt;asp:ListItem Text="Custom" Value=""&gt;&lt;/asp:ListItem&gt; &lt;/asp:RadioButtonList&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; &lt;/div&gt; &lt;/asp:Panel&gt; &lt;ajax:PopupControlExtender ID="PCESubject" runat="server" TargetControlID="txtSubject" PopupControlID="PanelDefaultSubjects" CommitProperty="value" Position="Right" OffsetX="5" CommitScript="e.value" /&gt; &lt;/asp:TableCell&gt; &lt;/asp:TableRow&gt; &lt;asp:TableRow ID="TableRowMessage" runat="server"&gt; &lt;asp:TableCell ID="TableCell7" runat="server"&gt; &lt;asp:Label ID="LabelMessageBody" runat="server" AssociatedControlID="txtMessageBody" Text="Message"&gt;&lt;/asp:Label&gt; &lt;/asp:TableCell&gt; &lt;asp:TableCell ID="TableCell8" runat="server"&gt; &lt;asp:TextBox ID="txtMessageBody" runat="server" Columns="40" Rows="10" Multiline="true"&gt;&lt;/asp:TextBox&gt; &lt;/asp:TableCell&gt; &lt;/asp:TableRow&gt; &lt;asp:TableRow ID="TableRowFileUpload" runat="server"&gt; &lt;asp:TableCell ID="TableCell9" runat="server"&gt; &lt;asp:Label ID="LabelFileAttached" runat="server" AssociatedControlID="AsyncFileUpload1" Text="Attach a file"&gt;&lt;/asp:Label&gt; &lt;/asp:TableCell&gt; &lt;asp:TableCell ID="TableCell10" runat="server"&gt; &lt;ajax:AsyncFileUpload ID="AsyncFileUpload1" runat="server" OnClientUploadComplete="FileUploaded" OnClientUploadError="ErrorUploaded" OnClientUploadStarted="UploadStarted" OnUploadedComplete="File_Uploaded" UploaderStyle="Modern" ThrobberID="LabelThobber" /&gt; &lt;asp:Label ID="LabelThobber" runat="server" Style="display: none"&gt;&lt;img alt="" src="Images/uploading.gif" /&gt;&lt;/asp:Label&gt;&lt;br /&gt; &lt;asp:Label ID="LabelStatusUpload" runat="server" Text=" "&gt;&lt;/asp:Label&gt; &lt;/asp:TableCell&gt; &lt;/asp:TableRow&gt; &lt;asp:TableRow ID="TableRowDueDate" runat="server"&gt; &lt;asp:TableCell ID="TableCell11" runat="server"&gt; &lt;asp:Label ID="LabelDueDate" runat="server" AssociatedControlID="txtDueDate" Text="Due Date"&gt;&lt;/asp:Label&gt; &lt;/asp:TableCell&gt; &lt;asp:TableCell ID="TableCell12" runat="server"&gt; &lt;asp:TextBox ID="txtDueDate" runat="server" Width="560px"&gt;&lt;/asp:TextBox&gt; &lt;ajax:MaskedEditExtender runat="server" ID="MEEDueDate" TargetControlID="txtDueDate" Mask="99/99/9999" AutoComplete="true" MaskType="Date"&gt; &lt;/ajax:MaskedEditExtender&gt; &lt;ajax:MaskedEditValidator ID="MEVDueDate" runat="server" ControlExtender="MEEDueDate" ControlToValidate="txtDueDate" IsValidEmpty="False" EmptyValueMessage="Due Date is required" InvalidValueMessage="Due Date is required" EmptyValueBlurredText="*" InvalidValueBlurredMessage="*" MaximumValueBlurredMessage="*" MinimumValueBlurredText="*" Display="Dynamic" /&gt; &lt;ajax:CalendarExtender ID="CalDueDate" runat="server" TargetControlID="txtDueDate"&gt; &lt;/ajax:CalendarExtender&gt; &lt;/asp:TableCell&gt;&lt;/asp:TableRow&gt; &lt;asp:TableRow ID="TableRowFrequency" runat="server"&gt; &lt;asp:TableCell ID="TableCell17" runat="server"&gt; &lt;asp:Label ID="LabelFrequency" runat="server" AssociatedControlID="txtFrequency" Text="Frequency"&gt;&lt;/asp:Label&gt; &lt;/asp:TableCell&gt;&lt;asp:TableCell ID="TableCell18" runat="server"&gt; &lt;asp:TextBox ID="txtFrequency" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;asp:Panel ID="PanelFrequency" runat="server"&gt; &lt;div&gt; &lt;asp:UpdatePanel ID="UpdatePanelFrequency" runat="server"&gt; &lt;ContentTemplate&gt; &lt;asp:RadioButtonList ID="RadioButtonFrequency" runat="server" AutoPostBack="true" OnSelectedIndexChanged="RadioSubjectFrequency_SelectedIndexChanged"&gt; &lt;asp:ListItem Text="15 min"&gt;&lt;/asp:ListItem&gt; &lt;asp:ListItem Text="6 hr"&gt;&lt;/asp:ListItem&gt; &lt;asp:ListItem Text="24 hr"&gt;&lt;/asp:ListItem&gt;&gt; &lt;/asp:RadioButtonList&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; &lt;/div&gt; &lt;/asp:Panel&gt; &lt;ajax:PopupControlExtender ID="PCEFrequency" runat="server" TargetControlID="txtFrequency" PopupControlID="PanelFrequency" CommitProperty="value" Position="Right" OffsetX="5" CommitScript="e.value" /&gt; &lt;/asp:TableCell&gt;&lt;/asp:TableRow&gt; &lt;asp:TableFooterRow&gt; &lt;asp:TableCell ID="TableCellSubmit" runat="server"&gt; &lt;asp:Button ID="BtnSubmit" runat="server" OnClick="Submit_Click" Text="Set Reminder Detailed" /&gt; &lt;/asp:TableCell&gt;&lt;asp:TableCell ID="TableCellCancel" runat="server"&gt; &lt;asp:Button ID="BtnCancel" runat="server" OnClick="Cancel_Click" Text="Cancel" /&gt; &lt;/asp:TableCell&gt;&lt;/asp:TableFooterRow&gt; &lt;/asp:Table&gt; &lt;/asp:Panel&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong>Code : page_Behind.aspx.cs</strong> </p> <pre><code>using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.IO; public partial class _Default : System.Web.UI.Page { //static protected string savePath; //static protected int curFileSize; //static protected bool IsFileAttached; protected void Page_Load(object sender, EventArgs e) { CalDueDate.StartDate = DateTime.Now.Date; CalDueDate.EndDate = DateTime.Now.Date.AddYears(1); MEVDueDate.MinimumValue = DateTime.Now.Date.ToShortDateString(); MEVDueDate.MaximumValue = DateTime.Now.Date.ToShortDateString(); } protected void RadioSubjectList_SelectedIndexChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(RadioSubjectList.SelectedValue)) { // Popup result is the selected task PCESubject.Commit(RadioSubjectList.SelectedValue); } else { // Cancel the popup PCESubject.Cancel(); } // Reset the selected item RadioSubjectList.ClearSelection(); } protected void RadioSubjectFrequency_SelectedIndexChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(RadioButtonFrequency.SelectedValue)) { PCEFrequency.Commit(RadioButtonFrequency.SelectedValue); } else { PCEFrequency.Cancel(); } RadioButtonFrequency.ClearSelection(); } protected void File_Uploaded(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e) { if (AsyncFileUpload1.HasFile) { string savePath = MapPath("~/Uploads/") + Path.GetFileName(DateTime.Now.Month + DateTime.Now.Day + " " + DateTime.Now.Hour + DateTime.Now.Minute + " " + e.FileName); AsyncFileUpload1.SaveAs(savePath); } } protected void Submit_Click(object sender, EventArgs e) { // On Submit button doesn't even reaches here, debugged and breakpoint on any of following code is never reached int lastID = BusinessLayer.DetermineLastDetailedID(); // Some other logic unimportant at this point BusinessLayer.AddDReminder(sender, e); } protected void Cancel_Click(object sender, EventArgs e) { txtName.Text = ""; txtEmail1.Text = ""; txtEmail2.Text = ""; txtEmail3.Text = ""; txtSubject.Text = ""; txtMessageBody.Text = ""; txtDueDate.Text = ""; txtFrequency.Text = ""; } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload