I have discovered a simpler way to load the .ascx control without triggering a postback.
By placing the .ascx control in an update panel and reloading only the update panel using the following JavaScript function:
function addCookies(typeShopping,id,name,price) {
document.cookie = typeShopping + "=" + id + "," + name + "," + price;
__doPostBack('<%=UpdatePanel2.ClientID %>', 'addTocart');
}
Parameters can be passed to the control or set to NULL. This is how I included the control within the update panel:
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel2" runat="server>
<ContentTemplate>
<uc1:Basket ID="Basket1" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
This method has worked flawlessly for me, and I haven't come across any drawbacks yet.