Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesAccess User Control from ModuleAccess User Control from Module
Previous
 
Next
New Post
1/19/2010 6:34 PM
 

I have created a new skin. Inside the skin I have created a simple user control (Located @ admin/skins/counter.ascx).

I have also created a Module. From inside the module, I would like to programatically check the user control "counter.ascx" that's inside the skin, and check if it exists. If it does exist, I would like to update it's value based on page/module actions. To make it easier to understand, the control is a shopping cart counter. The module is a shopping cart catalog. When an order is made, I would like to update the shopping cart counter's value. But I can't figure out how to access it from within the module!!!

Any help will be greatly appreciated. Thanks!

Frank

 
New Post
1/19/2010 7:04 PM
 

More info. I can access the control by using the following

Dim uc As UserControl = Page.LoadControl("~/Admin/Skins/CartCounter.ascx")

I then try and change the label inside that control

CType(uc.FindControl("lblCartCounter"), Label).Text = CType(Session("OrderCart"), System.Data.DataTable).Rows.Count

This works. I access the label inside the control, but now I actually want the control to refresh. The Page_Load of the control doesn't fire, just the page_load of the module. Ideas?

 
New Post
1/20/2010 2:08 PM
 

Scratch my last post. This is what I am trying to do.

My Skin file contains

<%@ Register TagPrefix="ccc" TagName="CARTCOUNTER" Src="~/Admin/Skins/CartCounter.ascx" %>

<ccc:CARTCOUNTER runat="server" ID="CARTCOUNTER" />

My User Control contains

<%@ Control Language="VB" AutoEventWireup="false" Explicit="True" Inherits="DotNetNuke.UI.Skins.Controls.CartCounter" CodeFile="CartCounter.ascx.vb" %>
 <asp:Label ID="lblCartCounter" runat="server" style="padding: 0 0 0 5px;" cssclass="SkinObject" /> Item(s)

Code:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Try

                If Not Session("TagCatalogOrderCart") Is Nothing Then
                    Update_Counter(CType(Session("TagCatalogOrderCart"), System.Data.DataTable).Rows.Count)
                End If

            Catch exc As Exception    'Module failed to load
                ProcessModuleLoadException(Me, exc)
            End Try
        End Sub

        Public Sub Update_Counter(ByVal value As String)

            lblCartCounter.Text = value

        End Sub

My Module Contains

 <%@ Register TagPrefix="ccc" TagName="CARTCOUNTER" Src="~/Admin/Skins/CartCounter.ascx" %>

<asp:UpdatePanel ID="updateTagCatalog" runat="server" UpdateMode="Always">
                <ContentTemplate>

             ORDER FORM HERE........with add to cart button

</ContentTemplate>               
            </asp:UpdatePanel>   

 Code: This gets called once the add to cart button is clicked

Protected Sub UpdateCartGUI()

            Dim Skin As DotNetNuke.UI.Skins.Skin
            Skin = Skin.GetSkin(Page)
            Dim uc As DotNetNuke.UI.Skins.Controls.CartCounter
            uc = CType(Skin.FindControl("CARTCOUNTER"), Skins.Controls.CartCounter)
            uc.Update_Counter(CType(Session("TagCatalogOrderCart"), System.Data.DataTable).Rows.Count)

End Sub

 

The problem is the user control always updates 1 click behind. I'm not sure how to resolve this, but any help will really be appreciated!!!

Thanks,

Frank

 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesAccess User Control from ModuleAccess User Control from Module


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out