Changing Text in a seperate control.

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
William_firefold
Commander (CMDR)
Commander (CMDR)
Posts: 186
Joined: Fri Aug 01, 2008 8:38 am

Changing Text in a seperate control.

Post by William_firefold » Fri Nov 13, 2009 6:37 am

We have a control in the header which will show the number of items in the cart and the total price of the cart. It looks like this:

Code: Select all

<asp:HyperLink NavigateUrl="~/Basket.aspx" runat="server"><span class="menubartotaltext">Cart:</span>&nbsp;<asp:Label ID="MessageLabel" runat="server" Text="{0} item{1}" /></asp:HyperLink><asp:HyperLink NavigateUrl="~/Basket.aspx" runat="server"><span class="menubartotaltext">Total:</span>&nbsp;<asp:Label ID="Total" runat="server"></asp:Label></asp:HyperLink>
And there is a .cs file to set the labels on page prerender.
Is there is way to update the values in the labels whenever an add to cart button is clicked(buyproductdialog) without having to refresh the whole page?
I cant figure out how it works with the minibasket, but id like to do a similar thing.

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Changing Text in a seperate control.

Post by mazhar » Fri Nov 13, 2009 6:41 am

Have a look at ConLib/CategorySearchSidebar and ConLib/Search.ascx controls they both are doing something similar where SearchPage partially get updates when some ones updates sidebar control.

User avatar
William_firefold
Commander (CMDR)
Commander (CMDR)
Posts: 186
Joined: Fri Aug 01, 2008 8:38 am

Re: Changing Text in a seperate control.

Post by William_firefold » Fri Nov 13, 2009 7:48 am

I messed with it a bit, but it looks like the category search sidebar has to implement an interface to be reachable by the search page. Does pagehelper have any way to directly access a seperate control?
Seems like there could be a simpler way that what the search page does.

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Changing Text in a seperate control.

Post by mazhar » Fri Nov 13, 2009 8:15 am

No, you have to follow rules as is the case with CategorySearchSidebar and SearchPage.

User avatar
William_firefold
Commander (CMDR)
Commander (CMDR)
Posts: 186
Joined: Fri Aug 01, 2008 8:38 am

Re: Changing Text in a seperate control.

Post by William_firefold » Fri Nov 13, 2009 8:26 am

doh! i knew it must be a security something

ozlighting
Lieutenant (LT)
Lieutenant (LT)
Posts: 53
Joined: Tue Mar 24, 2009 9:49 pm
Contact:

Re: Changing Text in a seperate control.

Post by ozlighting » Sun Nov 29, 2009 7:02 pm

Hi,

How about wrapping it in an ajax panel? I picked this up from another thread and it works for us (currently only on our test server though)

Code: Select all

<Ajax:UpdatePanel ID="UpdateBasket" runat="server">
<ContentTemplate>
<asp:HyperLink NavigateUrl="~/Basket.aspx" runat="server"><span class="menubartotaltext">Cart:</span>&nbsp;<asp:Label ID="MessageLabel" runat="server" Text="{0} item{1}" /></asp:HyperLink><asp:HyperLink NavigateUrl="~/Basket.aspx" runat="server"><span class="menubartotaltext">Total:</span>&nbsp;<asp:Label ID="Total" runat="server"></asp:Label></asp:HyperLink>
</ContentTemplate>
</Ajax:UpdatePanel>
Cheers,

Lance
Australian Online Lighting Store

log on and light up...

User avatar
William_firefold
Commander (CMDR)
Commander (CMDR)
Posts: 186
Joined: Fri Aug 01, 2008 8:38 am

Re: Changing Text in a seperate control.

Post by William_firefold » Tue Dec 01, 2009 12:16 pm

ozlighting wrote:Hi,

How about wrapping it in an ajax panel? I picked this up from another thread and it works for us (currently only on our test server though)


Cheers,

Lance
It works! Thanks very much, people kept complaining about it. Its strange, the types of trivial things customers get upset about.

Post Reply