<
telerik:RadGrid runat="server"
ID="grdActions"
AllowPaging="false"
Width="750px"
AutoGenerateColumns="false"
Skin="Office2007"
DataSourceID="TaskActionsDataSource"
OnPreRender="grdActions_PreRender"
OnItemCommand="grdActions_ItemCommand"
OnRowDrop="grdActions_RowDrop"
OnItemDataBound="grdActions_ItemDataBound"
>
<ClientSettings EnableAlternatingItems="true"
EnableRowHoverStyle="true"
AllowExpandCollapse="false"
AllowRowsDragDrop="true"
>
<Selecting AllowRowSelect="True" />
</ClientSettings>
<MasterTableView DataKeyNames="Id" TableLayout="Fixed"
AllowMultiColumnSorting="false"
AllowFilteringByColumn="false"
AlternatingItemStyle-BackColor="#F2F3F5"
>
<DetailTables>
<telerik:GridTableView HeaderStyle-BackColor="Beige" CommandItemStyle-BackColor="Beige"
Name="DetailsTable"
DataSourceID="ActionModuleCollectionDataSource"
DataKeyNames="Id"
AutoGenerateColumns="false"
CommandItemDisplay="Top"
TableLayout="Fixed"
HeaderStyle-CssClass="hideGridHeader"
NoDetailRecordsText="There is no training, meeting or procurement attached to the action above"
CssClass="detailGridMargin"
>
<CommandItemTemplate>
<div style="padding: 5px 5px;">
<asp:LinkButton ID="btnAddTraining" runat="server" CommandName="AddTraining" Font-Names="Tahoma" Font-Size="11px"><img style="border:0px; width: 25px; height: 17px; vertical-align:middle;" alt="" src="../Images/add_training.png" />Add Training</asp:LinkButton>
<asp:LinkButton ID="btnAddMeeting" runat="server" CommandName="AddMeeting" Font-Names="Tahoma" Font-Size="11px"><img style="border:0px; width: 25px; height: 17px; vertical-align:middle;" alt="" src="../Images/add_meeting.png" />Add Meeting</asp:LinkButton>
<asp:LinkButton ID="btnAddProcurement" runat="server" CommandName="AddProcurement" Font-Names="Tahoma" Font-Size="11px"><img style="border:0px; width: 25px; height: 17px; vertical-align:middle;" alt="" src="../Images/add_procurement.png" />Add Procurement</asp:LinkButton>
</div>
</CommandItemTemplate>
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="Id" MasterKeyField="Id" />
</ParentTableRelation>
<Columns>
<telerik:GridBoundColumn UniqueName="ModuleType" DataField="ModuleType" HeaderStyle-Width="100px"></telerik:GridBoundColumn>
<telerik:GridHyperLinkColumn UniqueName="meetingurl"
DataTextField="Title" DataNavigateUrlFields="Id" DataNavigateUrlFormatString="../Meeting/Meeting.aspx?actionId={0}&ViewMode=ReadOnly"
>
</telerik:GridHyperLinkColumn>
</Columns>
</telerik:GridTableView>
</DetailTables>
<Columns>
<telerik:GridBoundColumn
DataField="SortCode"
Visible="true"
HeaderText="#"
HeaderStyle-Width = "30"
ItemStyle-Font-Bold="true"
ItemStyle-Font-Names="Tahoma"
>
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn UniqueName="TemplateColumn" InitializeTemplatesFirst="false">
<HeaderTemplate>
<table id="Table1" cellspacing="0" cellpadding="0" border="0">
<tr>
<td colspan="0">
<b>Action Details</b>
</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td style="border-width: 0px;"><input type="hidden" id="hiddenActionId" value="<%# Eval("Id") %>" /></td>
</tr>
<tr>
<td colspan="6" style="width: 200px; font-size: 12px; font-family: Tahoma;">
<b>Name: </b><%# Eval("Description") %> (<%# Eval("TypeName") %>) <%# Convert.ToBoolean(Eval("Location").Equals("")) ? "" : ":: " + Eval("Location")%>
</td>
<td align="right">
<img src="../images/status_<%# Eval("StatusName")%>.png" alt="<%# Eval("StatusName")%>" />
</td>
</tr>
<tr>
<td colspan="4" style="width: 250px; font-size: 12px; font-family: Tahoma;">
<b>Output: </b> <%# Eval("Output") %>
</td>
<td rowspan="3" style="width: 50px; font-size: 12px; font-family: Tahoma;" align="center">
<img src="../images/status_<%# Convert.ToBoolean(Eval("NoBudgetFlag")) ? "nobudget" : "budget" %>.png"
alt='<%# Convert.ToBoolean(Eval("NoBudgetFlag")) ? "No budget required for this action" : "Budget estimation required for this action" %>' />
</td>
<td colspan="2" rowspan="3" style="width: auto; font-size: 12px; font-family: Tahoma;" align="center">
$ <%
# Eval("TotalEstimationInDollar") %> <%# Eval("TotalEstimationInEuro") %>
<br />
<%
if (iViewBudget == 0)
{ %>
<a href="#" onclick="openRadWindowEstimation('<%# DataBinder.Eval(Container.DataItem, "Id") %>'); return false;" id="linkEstimation" class="smallFont" style="font-size: 9px; font-weight:bold; font-family: Tahoma; color: #0099FF;">[VIEW/MODIFY BUDGET]</a><% } %>
</td>
</tr>
<tr>
<td colspan="4" style="font-size: 12px; font-family: Tahoma;">
<b>Date: </b> <%# Eval("StartDate") %> <%# Convert.ToBoolean(Eval("CompletionDate").Equals("")) ? "" : " to " + Eval("CompletionDate") %>
</td>
</tr>
<tr>
<td colspan="4" style="font-size: 12px; font-family: Tahoma;">
<b>Comment: </b> <%# Eval("Comment") %>
</td>
</tr>
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script language="javascript" type="text/javascript">
function RefreshFinancialRelatedGrids(RadWindow) {
$find(
'<%=this.RadAjaxManager1.ClientID%>').ajaxRequest("Rebind");
}
function openRadWindowEstimation(actionId) {
// var lnkProbisWindow = document.getElementById("ctl00_messagePanelsContent_contentPlaceHolder_fvTaskDetail_linkEstimation");
// var hdnViewmodifyBudget = document.getElementById("ctl00_messagePanelsContent_contentPlaceHolder_fvTaskDetail_hdnViewmodifyBudget");
//
// if (hdnViewmodifyBudget.value == "1")
// lnkProbisWindow.enabled = false;
// else {
var oWnd = radopen("Task_Estimation.aspx?actionid=" + actionId + "&disableMaster=1", "RadWindowTaskEstimation");
oWnd.Center();
//}
}
</script>
</telerik:RadCodeBlock>
<telerik:RadWindowManager ID="RadWindowManagerTaskEstimation" runat="server" Modal="true">
<Windows>
<telerik:RadWindow ID="RadWindowTaskEstimation" runat="server"
DestroyOnClose="true" Modal="true"
Skin="Vista" Animation="None" ShowContentDuringLoad="false" VisibleStatusbar="false"
KeepInScreenBounds="true" Width="1000px" Height="750px" Behavior="Close" />
</Windows>
</telerik:RadWindowManager>
</table>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
Webpage error detailsUser Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB6.6; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 1.1.4322; .NET CLR 3.5.21022; InfoPath.2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)Timestamp: Wed, 13 Jul 2011 16:42:09 UTCMessage: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 405Line: 6Char: 84093Code: 0URI: http://www.nirvanawebworks.com/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d4.0.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-US%3a1f68db6e-ab92-4c56-8744-13e09bf43565%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%2c+Version%3d2011.1.519.40%2c+Culture%3dneutral%2c+PublicKeyToken%3d121fae78165ba3d4%3aen-US%3a911e11b9-43a3-4153-a0e1-a8dd325e7573%3a16e4e7cd%3af7645509%3a24ee1bba%3af46195d3%3a1e771326%3aaa288e2d%3ab7778d6c%3a11e117d7%3a7165f74<telerik:RadComboBox ID="ddlOwnProjects" runat="server" DataTextField="Name" MarkFirstMatch="true" AutoPostBack="true" Width="180px" EnableEmbeddedSkins="false" Skin="DefaultGBT" DataValueField="Id" LoadingMessage="<%$ Resources:PGC, General_LoadingText %>" EmptyMessage="<%$ Resources:PGC, General_DdlPleaseSelectTitle %>" OnSelectedIndexChanged="ddlOwnProjects_SelectedIndexChanged" AppendDataBoundItems="true" Visible="true"> <Items> <telerik:RadComboBoxItem Text="<%$ Resources:PGC, General_DdlPleaseSelectTitle %>" Value="None" Selected="true" Enabled="false" /> </Items> </telerik:RadComboBox>I have an ASP.NET web page with two postback events and the second one is aborting the first. The second one then doesn't render as expected once it completes.
In Detail
I have an ASP.NET web page that effectively contains two link buttons. It uses the Telerik ASP.NET AJAX controls, but I'm not sure if the behaviour is specfic to these controls:
The Page - an extremely cut-down version is as follows:
<telerik:RadToolTipManager ID="RadToolTipManager1" runat="server"
Position="BottomLeft" RelativeTo="Element" ShowEvent="OnClick"
HideEvent="ManualClose" Animation="Fade" OnAjaxUpdate="OnShowItems" >
<TargetControls>
<telerik:ToolTipTargetControl TargetControlID="btnShowItems" />
</TargetControls>
</telerik:RadToolTipManager>
...
...
<asp:LinkButton ID="btnShowItems" runat="server" Visible="false">
<span><%= ItemsPrompt %></span>
</asp:LinkButton>
...
...
<uc1:X ID="XControl" runat="server"/>
The UserControl "X" - an extremely cut-down version is as follows:
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server"
LoadingPanelID="LoadingPanel1" RenderMode="Block">
<asp:LinkButton runat="server" ID="CausePostbackButton"
Style="display: none" />
</telerik:RadAjaxPanel>
Use Case #1 - successful
Use Case #2 - failure
The page loads and a JavaScript timer within Control "X" activates a postback on the LinkButton "CausePostbackButton". (So, this mimics a user clicking the button).
Before the server has time to respond, the User clicks on the LinkButton "btnShowItems".
In FireFox/Firebug, you can see that the first post-back event is "Aborted". The second post-back event completes (you can see the time taken reported) but the page is not visually updated.
If the "manual" button is then clicked again, then that works as expected.
My thoughts
I know that JavaScript is single threaded, so if events can't be run immediately then they are queued.
I know that if a timer fires an event that is queued and then fires the same event whilst the first event is still queued, then one of these events (the second?) will be dropped.
This is acting as if the first event is being trashed, but then the second event can no longer find its "channel" to write to.
However, if I change the "manual" Link Button to an Image Button then the behaviour does not change.
Any ideas what the problem is (and ideally a solution)?
Many thanks in advance
Griff
submitted by bmcmillen<%@ Page Language="C#" AutoEventWireup="true" %> <%@ Import Namespace="System.Data" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>How to Change the TotalRowCount ...</title> </head> <body> <form id="form1" runat="server"> <script runat="server" language="c#"> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.RadGrid1.DataSource = DataPage(0); this.RadGrid1.DataBind(); } } public DataRow[] DataPage(int PageIndex) { string sql = string.Empty; switch (this.RadComboBox1.SelectedValue) { case "2": sql = "pkID >= " + (PageIndex * 5 + 1) + " AND pkID <= " + (PageIndex * 5 + 5) + ""; return dt2().Select(sql); default: sql = "pkID >= " + (PageIndex * 5 + 1) + " AND pkID <= " + (PageIndex * 5 + 5) + ""; return dt1().Select(sql); } } protected void RadComboBox1_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e) { this.RadGrid1.DataSource = DataPage(this.RadDataPager1.CurrentPageIndex); this.RadGrid1.DataBind(); } protected void RadDataPager1_PageIndexChanged(object sender, RadDataPagerPageIndexChangeEventArgs e) { this.RadGrid1.DataSource = DataPage(e.NewPageIndex); this.RadGrid1.DataBind(); } protected void RadDataPager1_TotalRowCountRequest(object sender, RadDataPagerTotalRowCountRequestEventArgs e) { this.RadDataPager1.TabIndex = 1; switch (this.RadComboBox1.SelectedValue) { case "1": e.TotalRowCount = dt1().Rows.Count; break; case "2": e.TotalRowCount = dt2().Rows.Count; break; } } public static DataTable dt1() { DataTable table = new DataTable(); table.Columns.Add("pkID", typeof(Int32)); table.Columns.Add("ParentID", typeof(Int32)); table.Columns.Add("Name", typeof(String)); table.Columns.Add("Text", typeof(String)); table.Rows.Add(new object[] { 1, 1, "testName1", "testText1" }); table.Rows.Add(new object[] { 2, 1, "testName2", "testText2" }); table.Rows.Add(new object[] { 3, 1, "testName3", "testText3" }); table.Rows.Add(new object[] { 4, 1, "testName4", "testText4" }); table.Rows.Add(new object[] { 5, 1, "testName5", "testText5" }); table.Rows.Add(new object[] { 6, 1, "testName6", "testText6" }); table.Rows.Add(new object[] { 7, 1, "testName7", "testText7" }); table.Rows.Add(new object[] { 8, 1, "testName8", "testText8" }); table.Rows.Add(new object[] { 9, 1, "testName9", "testText9" }); table.Rows.Add(new object[] { 10, 1, "testName10", "testText10" }); table.Rows.Add(new object[] { 11, 1, "testName11", "testText11" }); table.Rows.Add(new object[] { 12, 1, "testName12", "testText12" }); return table; } public static DataTable dt2() { DataTable table = new DataTable(); table.Columns.Add("pkID", typeof(Int32)); table.Columns.Add("Name", typeof(String)); table.Rows.Add(new object[] { 1, "C" }); table.Rows.Add(new object[] { 2, "C++" }); table.Rows.Add(new object[] { 3, "C#" }); table.Rows.Add(new object[] { 4, "Java" }); table.Rows.Add(new object[] { 5, "F++" }); table.Rows.Add(new object[] { 6, "Z++" }); return table; } </script> <telerik:RadScriptManager ID="RadScriptManager1" runat="server" /> <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="RadComboBox1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadComboBox1" /> <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> <telerik:AjaxUpdatedControl ControlID="RadDataPager1" /> </UpdatedControls> </telerik:AjaxSetting> <telerik:AjaxSetting AjaxControlID="RadDataPager1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadDataPager1" /> <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadComboBox ID="RadComboBox1" Runat="server" AutoPostBack="true" onselectedindexchanged="RadComboBox1_SelectedIndexChanged"> <Items> <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem1" Value="1" Selected="true" /> <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem2" Value="2" /> </Items> </telerik:RadComboBox> <telerik:RadGrid ID="RadGrid1" runat="server" PageSize="5"> </telerik:RadGrid> <telerik:RadDataPager ID="RadDataPager1" runat="server" PageSize="5" ontotalrowcountrequest="RadDataPager1_TotalRowCountRequest" onpageindexchanged="RadDataPager1_PageIndexChanged"> <Fields> <telerik:RadDataPagerButtonField FieldType="NextLast" HorizontalPosition="RightFloat" /> <telerik:RadDataPagerButtonField FieldType="Numeric" PageButtonCount="10" HorizontalPosition="RightFloat" /> <telerik:RadDataPagerButtonField FieldType="FirstPrev" HorizontalPosition="RightFloat" /> <telerik:RadDataPagerGoToPageField CurrentPageText="" TotalPageText="/" TextBoxWidth="38" SubmitButtonText="Go" HorizontalPosition="RightFloat" /> </Fields> </telerik:RadDataPager> </form> </body> </html>