I have an XmlHttpPanel that is within an AjaxPanel. The problem I'm having is the first time there is a postback, it does a full page refresh instead of a partial page refresh; it's as if the AjaxPanel isn't having an effect. But on subsequent postbacks it does the partial page refresh the way I want it to.
Here's a more detailed description:
I have a user control, named RecordSelect.ascx, that contains an XmlHttpPanel. It calls a web service that returns HTML. It calls __doPostBack to post back to the web server. Here is the markup of my user control:
And here's the parent, where the RecordSelect.ascx control is declared inside a RadAjaxPanel
FYI -
This control is a typeahead/autocomplete type search.
The <%=XmlHttpPanel1.ClientID %> string is appended to the javascript function names so the user control can be declared multiple times on one page. (I'm not sure if that's the proper way to do that...but it's working.)
The purpose of the cmdHid button is to prevent the __doPostBack commands from causing client-side validation, and also to associate the postbacks with the surrounding AjaxPanel, which is working for the 2nd, 3rd, 4th, etc. postbacks. Just not the first postback.
Any help would be much appreciated.
Here's a more detailed description:
I have a user control, named RecordSelect.ascx, that contains an XmlHttpPanel. It calls a web service that returns HTML. It calls __doPostBack to post back to the web server. Here is the markup of my user control:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="RecordSelect.ascx.cs" Inherits="RecordSelect" %> <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> <script type="text/javascript"> var call = 0; function SetValue<%=XmlHttpPanel1.ClientID %>(count) { var panel = $find("<%=XmlHttpPanel1.ClientID %>"); //you can pass any kind of object to the GetHTML method //right now we will pass an array var array = []; if (document.getElementById('<%=txtSearchString.ClientID %>').value.length > 1 && count == call) { array[0] = document.getElementById('<%=txtSearchString.ClientID %>').value; array[1] = "<%=XmlHttpPanel1.ClientID %>"; array[2] = document.getElementById('<%= hidANE.ClientID %>').value; call = 0; //you can pass any kind of object to the GetHTML method //right now we will pass an array panel.set_value(array); } } function GetData<%=XmlHttpPanel1.ClientID %>() { call++; setTimeout('SetValue<%=XmlHttpPanel1.ClientID %>(' + call + ')', 200); } function RecordClicked<%=XmlHttpPanel1.ClientID %>(Name, ID) { document.getElementById('<%= hidId.ClientID %>').value = ID; document.getElementById('<%= txtSearchString.ClientID %>').value = Name; var panel = $find("<%=XmlHttpPanel1.ClientID %>"); // this will clear the xmlhttp panel. //document.getElementById('divTypeAheadOptions').parentNode.innerHTML = ''; $find('<%= txtSearchString.ClientID %>').updateDisplayValue(); __doPostBack('<%= cmdHid.ClientID %>',''); } function AddNewClicked<%=XmlHttpPanel1.ClientID %>() { document.getElementById('<%= hidId.ClientID %>').value = -1; __doPostBack('<%= cmdHid.ClientID %>',''); } </script> <telerik:RadTextBox ID="txtSearchString" runat="server" EmptyMessage="" Width="300px" > </telerik:RadTextBox> <telerik:RadXmlHttpPanel runat="server" ID="XmlHttpPanel1" WebMethodPath="~/services/TypeAhead.asmx" WebMethodName="" RenderMode="Block" EnableClientScriptEvaluation="true"> </telerik:RadXmlHttpPanel> <asp:HiddenField runat="server" ID="hidId"/> <asp:HiddenField runat="server" ID="hidANE" /> <asp:Button runat="server" ID="cmdHid" CausesValidation="false" style="display: none;"/> And here's the parent, where the RecordSelect.ascx control is declared inside a RadAjaxPanel
<telerik:RadAjaxPanel ID="radAjaxPanel1" runat="server"> <uc1:RecordSelect runat="server" ID="selCompany" Type="Companies" EnabledAddNew="True" /> ... FYI -
This control is a typeahead/autocomplete type search.
The <%=XmlHttpPanel1.ClientID %> string is appended to the javascript function names so the user control can be declared multiple times on one page. (I'm not sure if that's the proper way to do that...but it's working.)
The purpose of the cmdHid button is to prevent the __doPostBack commands from causing client-side validation, and also to associate the postbacks with the surrounding AjaxPanel, which is working for the 2nd, 3rd, 4th, etc. postbacks. Just not the first postback.
Any help would be much appreciated.