Reputation: 1923
I have an application that has multiple buttons. I am trying to keep the page from being reloaded (which interferes with other Controls) every time the button is clicked, so I have wrapped the main part of the code in <asp:UpdatePanel><ContentTemplate></ContentTemplate></asp:UpdatePanel>
. I have already looked at multiple solutions for single buttons involving the use <Triggers><asp:AsyncPostBackTrigger>...
just after the </ContentTemplate>
but this does not resolve my issue. I am using AjaxControlToolkit
(I have added using AjaxControlToolkit;
to my C# file) as well as a ModalPopExtender
which seem to affect the behavior of UpdatePanel
, according to some solutions. Without posting the entire applications (its very long), here is the basic layout of the current code (aspx and C#) and what I have tried so far. Any suggestions on what I am doing wrong?
ASPX
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
<div class="container" id="table_controls_section" style="margin-top: 20px; width: 100%;">
<div class="row" style="width: 100%;">
<table style="border-style:solid; border-color: darkblue; border-width:thin; border-bottom-width: 0px; width:100%;">
<tr>
<th style="text-align: center;">Requestor Info</th>
</tr>
<tr>
<td style="padding: 5px; text-align: center; width: 100%;">
<asp:Button ID="uxTicketHistoryButton" runat="server" Text="Show Ticket History" style="color: blue;" OnClick="uxTicketHistoryButton_Click"/>
<asp:Button ID="uxUseContactInfoButton" runat="server" Text="Use Contact Info" style="color: blue;" OnClick="uxUseContactInfoButton_Click" />
</td>
</tr>
</table>
</div>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="uxUseContactInfoButton" />
<asp:AsyncPostBackTrigger ControlID="uxTicketHistoryButton" />
</Triggers>
</asp:UpdatePanel>
C#
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AjaxControlToolkit;
namespace BCA_TicketManagement
{
public partial class Summary : Page
{
....
protected void uxTicketHistoryButton_Click(object sender, EventArgs e)
{ ....
}
protected void uxUseContactInfoButton_Click(object sender, EventArgs e)
{ ....
}
}
}
Things I have tried so far:
1) Adding using AjaxControlToolkit;
to C# code. It shows in my References as well.
2) Adding UpdateMode="Conditional" ChildrenAsTriggers="true"
to my asp:UpdatePanel
. Also tried changing ChildrenAsTriggers="false"
. No difference.
3) Trying to get UpdatePanel
to work for a single button by adding <Triggers><asp:AsyncPostBackTrigger...>
using the ControlID
for that button. No change.
4) Adding xmlns:asp="#unknown"
to <asp:AsyncPostBackTrigger...>
. Throws error AsyncPostBackTrigger has no property 'xmlns:asp="#unknown"'
Note This page is loaded inside a <form>
tag in the Master.site
using <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
.
Upvotes: 0
Views: 1446
Reputation: 495
You should provide your EventName
to your Trigger as shown in the following example:
<Triggers>
<asp:AsyncPostBackTrigger ControlID="uxUseContactInfoButton" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="uxTicketHistoryButton" EventName="Click" />
</Triggers>
I hope that will resolve your problem.
Upvotes: 1