Reputation: 175
I have some code that is running fine , what i want is when i create a cookie i want the .ascx control to load to perform some function on the cookie but i don't want the page to post back, how can i achieve that.
Upvotes: 1
Views: 3352
Reputation: 175
Well i found a more simpler way how to just load the .ascx control without postback
Just put the .ascx control in a update panel and reload the update panel only using this..
function addCookies(typeShopping,id,name,price) {
document.cookie = typeShopping + "=" + id + "," + name + "," + price;
__doPostBack('<%=UpdatePanel2.ClientID %>', 'addTocart');
}
And as you can see we can pass parameters to the control or just write NULL. And i place the control in the update panel like this....
<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 works absolutely perfect for me i don't know if there is any drawback using this concept.
Upvotes: 0