I have a web user control being used by another web user control, but the one being used will not display the labels in the resx file.

I am using DotNetNuke version 3.13 (might be 3.013) on a Window's XP machine, SP2. 

I have what I find to be an extremely odd situation. I have a project called TDS.Controls. This project is a web control library. Each control has its own resx file, which is located in the App_LocalResources directory. Each control inherits from Framework.UserControlBase, just like DotNetNuke's User control in DNN\Controls\User.ascx.vb. As a matter of fact, this control is doing the exact same thing I am trying to do. It is a web user control with its own resx file being used by another web user control (See DNN\Admin\Users\ManageUsers.ascx) that exists in a different directory altogether.

My issue is that when using the UI.UserControls.LabelControl,
the label and the help text will not display. I have set the control name property to a list box (for giggles, I tried a text box, but that didn't work). It has its runat="server" and the id declared inside of the ascx file is the same id used in the ascx.vb file. For thoroughness sake, I am posting the code i've used below:

In the ctrlCounty.ascx file:

<%@ Control Language="vb" AutoEventWireup="false" Codebehind="ctrlCounty.ascx.vb" Inherits="OSDE.Wave.Controls.ctrlCounty" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<%@ Register TagPrefix="dnn" TagName="label" Src="~/controls/labelControl.ascx" %>
<table width="80%" align="center" border="1">
 <tr align="center">
  <td align="right"><dnn:label id="plCountyDescriber" controlname="ddlCounty" runat="server"></dnn:label></td>
  <td align="left"><asp:dropdownlist id="ddlCounty" runat="server" AutoPostBack="true"></asp:dropdownlist>
   <asp:TextBox id="txtCounty" runat="server"></asp:TextBox></td>

In the ctrlCounty.ascx.vb file:

Protected WithEvents plCountyDescriber As UI.UserControls.LabelControl

In the ctrlCounty.ascx.resx file:

<?xml version="1.0" encoding="utf-8" ?>
    Microsoft ResX Schema
    Version 1.3
    The primary goals of this format is to allow a simple XML format
    that is mostly human readable. The generation and parsing of the
    various data types are done through the TypeConverter classes
    associated with the data types.
    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">1.3</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1">this is my long string</data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        [base64 mime encoded serialized .NET Framework object]
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        [base64 mime encoded string representing a byte array form of the .NET Framework object]
    There are any number of "resheader" rows that contain simple
    name/value pairs.
    Each data row contains a name, and value. The row also contains a
    type or mimetype. Type corresponds to a .NET class that support
    text/value conversion through the TypeConverter architecture.
    Classes that don't support this are serialized and stored with the
    mimetype set.
    The mimetype is used forserialized objects, and tells the
    ResXResourceReader how to depersist the object. This is currently not
    extensible. For a given mimetype the value must be set accordingly:
    Note - application/x-microsoft.net.object.binary.base64 is the format
    that the ResXResourceWriter will generate, however the reader can
    read any of the formats listed below.
    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with
            : System.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.

    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
 <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
  <xsd:element name="root" msdata:IsDataSet="true">
    <xsd:choice maxOccurs="unbounded">
     <xsd:element name="data">
        <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
        <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
       <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
       <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
       <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
     <xsd:element name="resheader">
        <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
       <xsd:attribute name="name" type="xsd:string" use="required" />
 <resheader name="resmimetype">
 <resheader name="version">
 <resheader name="reader">
  <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
 <resheader name="writer">
  <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
 <data name="$this.TrayAutoArrange" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
 <data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
 <data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
 <data name="plCountyDescriber.Text">
  <value>Select a county:</value>
 <data name="plCountyDescriber.Help">
  <value>Select a county from the drop down list.</value>

I have stared at the directory structure, code used, and anything else I can think of. It looks to me that I have my control set up exactly like DotNetNuke has its User control setup, save that their's works and mine does not. I am at a tremendous lost as to what I have done wrong. Please aid me in any way you can.

6/18/2005 1:12:36 AM
asp.net.dotnetnuke 25171 articles. 0 followers. Follow

6 Replies

Similar Articles

[PageSpeed] 6
Get it on Google Play
Get it on Apple App Store

In the plCountyDescriber tag, add the following property:

<dnn:label id="plCountyDescriber" controlname="ddlCounty" runat="server" resourcekey="plCountyDescriber"></dnn:label>

BTW, I should mention that you are using a standard asp:label, not a DotNetNuke label control, so the controlname won't do anything, and the .Help text also will not apply.

In order to use the DNN label control, add this line to the ascx file:
<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %>

and then use the control like this:
<dnn:label id="plCountyDescriber" runat="server" controlname="ddlCounty" suffix=":" resourcekey="plCountyDescriber"></dnn:label>
-Todd Davis
6/18/2005 1:40:16 AM
I greatly appreciate your reply. I modified my ascx file to like: 

<%@ Control Language="vb" AutoEventWireup="false" Codebehind="ctrlCounty.ascx.vb" Inherits="OSDE.Wave.Controls.ctrlCounty" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<%@ Register TagPrefix="dnn" TagName="label" Src="~/controls/labelControl.ascx" %>
<table width="80%" align="center" border="1">
 <tr align="center">
  <td align="right"><dnn:label id="plCountyDescriber"  controlname="ddlCounty" runat="server" suffix=":" resourceKey="plCountyDescriber" ></dnn:label></td>
  <td align="left"><asp:dropdownlist id="ddlCounty" runat="server" AutoPostBack="true"></asp:dropdownlist>
   <asp:TextBox id="txtCounty" runat="server"></asp:TextBox></td>

This still does not work, though. Any other ideas?
6/20/2005 12:42:42 PM
 jbaisden wrote:
Any other ideas?

Sure - let's hard code it, and do a little troubleshooting at the same time.

The resourcekey="" thing should work - if it isn't, then likely you don't have the *.resx file in the correct location. But ok, so let's do this - in the Page_Load() event (make this the first line in the function, before any postback checks, etc.) put this line:

plCountyDescriber.Text = Localization.GetString("plCountyDescriber", LocalResourceFile)

This will go out to the *.resx file, look for the string associated with plCountyDescriber.Text, and pull it in. If this does not work, then...

First, open up your *.resx file, and make sure that the data item exists, and looks like this:

<data name="plCountyDescriber.Text">

<value>County Describer</value>


Pay particluar attention to the case of the name="" value, it is case sensitive.

If that entry exists and looks kosher, then do this:

In the Page_Load() event, after the line above, do a simple:


Reload the page and look at the output at the very top of the page, it will display the path to the *.resx file. Make sure this is the correct path! To be honest with it - it IS the right path - if your *.resx file isn't there, it should be. But, you can also put any path you like, if you don't want to move it. i.e.:

plCountyDescriber.Text = Localization.GetString("plCountyDescriber", "/mystuff/my.resx")

-Todd Davis
6/20/2005 1:35:43 PM
I've had some whoppers in my time as a programmer (almost 2 years...yea i've been around real long...), but this takes the cake. I don't know what I changed or did not change. I tried your code todd and the directory printed out by the response stream was right on the money. I was actually hoping it wouldn't be. So then I added your code: 

plCountyDescriber.Text = Localization.GetString("plCountyDescriber", "/mystuff/my.resx")

but instead of "/mystuff/my.resx", I used the resource directory retrieved by

'Taken from dotnetnuke's user.ascx.vb file where MyFileName is a private string that is hardcoded
'with the filename.
ReadOnly Property LocalResourceFile() As String
Return Services.Localization.Localization.GetResourceFile(Me, MyFileName)
End Get
End Property

After doing this the control's text and help label's loaded. I thought, well, duh! of course it should load, I hard coded the bloody thing. So I remove the
plCountyDescriber.Text = Localization.GetString("plCountyDescriber", "/mystuff/my.resx")
and reload everything. Presto, the damn thing works. Honestly, it really shouldn't. I didn't change anything. The only theory I have is one borrowed from a co-worker that figured VS .Net was not re-loading the modified *.resx file that had the keys for this control. By adding this code, I force .Net to load the new file. When I removed the code, it had the file cached so it worked. It really doesn't make much sense to me as to how this issue occurred or if its just a whole bunch of bolony. No matter, though, it's working now.

Thank you so much for your help. I have easily spent 12 hours on this single issue. I have been dreading this morning as it seemed a bit dreary at this point. Alas, my hope rekindled.



6/20/2005 2:29:23 PM
I'm glad you got it working. I miss the good old days when you fixed the TV by kicking it... hard... how do you code a kick?Big Smile [:D]
-Todd Davis
6/20/2005 2:49:49 PM
I ran into this same problem.  When once .ascx file loads another .ascx file.  In my case, the LocalResourceFile was incorrect!  It was actually pointing to the name of the control instance.  For instance, the control was named "ControlName.ascx", and registered on my page as TagName="ControlNameCtrl".  I had an instance of that control on my page where the Control Id was "ControlNameCtrl1" (which is the default name that VS gives you).

It just so happened that DNN points LocalResourceFile to "/DesktopModules/MyModule/App_Local/ControlNameCtrl1" which doesn't seem correct.  It would seem that it should point to name of the user control (ControlName.ascx) and not the instance of that Control (ControlNameCtrl1), because that would mean that you need 1 resource file for every instance???  I don't think so!  My fix was to hard code the LocalResourceFile to point to where I think that it should point.

Figured that I would post this just in case anyone else is struggling with it or I forget and hit it in the future! :)
10/5/2005 1:24:00 AM

Similar Artilces:

How to use a web user control from one web app in another web app?
I have a production web app project (at work) that has custom web user controls in it.I have another web app project for experimenting and I want to use some web controls from the production web app. The big trick is that I need to load the controls dynamically.LoadControl() doesn't seem to work - it complains about loading controls from a different application. I also tried adding a project reference to the production web app and using "UC1 newUC = new UC1();" and then "this.Controls.Add(newUC);", but the controls (like TextBoxes) on the web user control don't seem to exist on the new UC1s....

Use Web Custom control or Web User control?
Friends,  I have a generic aspx page and its functions which is used in many .NET web application. The generic page contains a HTML Div control, server drop down list, server buttons, server textbox and it have different server and client functions to do its tasks for calling aspx pages in web applications. My problem is I do not know whether I should make that generic page as a web user control (but this is tedious because all other application folders must store frontpage aspx and code behind files of the generic page) or as a web custom control (This seems to be good beca...

Web User Control to Web User Control...
Hi, I have 2 User controls on a page and want Control1 to call a method of Control2. Is this Possible? Example: Con1 = Datalist showing products, each with a Quantity Box and a Button. Con2 = Repeater showing Cart Preview (name, Price) in page.aspx. When I click on the button on the DataList in Con1 it adds the item into the Session based Cart. However it does not update the Cart Preview. I need to call BindPreview() in Con2 in order to update the Cart Preview... Does that make sense? argh! any help much appreciated! PeteWeb Design Nottingham, UK Well I can call BindPreview() from m...

access controls on web user control x from web user control Y
I have 2 web users controls in a page and I would like to get or set the selected values of a few dropdown boxes on web user control X from web user control Y and I also would like to know how to access functions that are on a web user control X from a web user control Y, is this possible? How can I do it? User can access and set the values of the User Control from .aspx page through properties,using javascript and in code-behind of aspx page.The details of it are shown below Using PropertiesIf the Sample.ascx control has two textboxes and submit button.You can access the valu...

Web user control inside update panel replace with another web user control
 Hi there. I have a page with a menu. an and then the content. My thing is. That i have the update panel, and inside that i have a regual panel in which i add the Web User Controls i need. Which all works fine. My problem is. That i i have a submit funcion on almoast all the Web User controls. What i would like is that i inside that update panel, can dispose the original Web user Control and then add a response Web User Control. In normal language. Is there a way that i can load one web user control into antoher and then disposose the original? Thanks in advance hello. well, what ...

Updating a Label control in one user control from another user control
Hi all, I have a main page in my music store site that has 5 user controls on it with 1 always showing main content and the others being things like a shopping cart, "best sellers", genre list etc (a la amazon). From the main content control I want to be able to set some label controls in my shopping basket control but I just can't seem to work out the syntax for how to do this: Here's the code I'm using - I'm trying to go to the 4th user control on the page (my shopping basket) then find the appropraite label, cast it locally as a Label then update the value: Label _so...

how to use an user control inside another user control?
as title, I can't wirte an user control inside an user control. how's the solution? thanks... you can. Then you gotta use the FindControl() method to manipulate it."Never argue with an idiot; He will drag you down to his level and beat you with experience"...

Using user control within another user control
Hi, Can I register and instantiate a user control within another user control. Yes, of course you can.  If you are doing it dynamically, then you have to remember that you have to do it in every postback there after. <%@ Register Src="usercontrol1.ascx" TagName="TagName" TagPrefix="uc1" %> <uc1:TagName ID="UserControlID1" runat="server" /> ...

Using Web Controls outside of a User Control
I am using several user controls within my application but want to be able to use controls outside the user control. How can I do this?  For example I want to be able to switch visibility of other controls within the page.   Is this possible?  Thanks in advance Hey, You're not saying access a control within a user control outside of the user control?  If you're not, you can access any server control like you do a user control, through its name.  That works.  If you are talking accessing a control in a user control outside of it, it's best t...

want to call one c#.net function in one user control from another user control
hi i have two user controls info.ascx and personal.ascx i have a function like in info.ascx i have a function like showdetails() {   } now i want to access this function from personal.ascx can i do this ? thanks in advance. shwetaThanksshwetaIn a day when don't come across any problem -you can be sure that you are traveling in wrong path  you should better create a class where you will define the "functions" that you need in both files. declare "static" the function and call it like nameofclass.nameoffunction In a web project you can...

Persisting data in a web user control, which contains a list of other web user controls.
 Hi All, I have a control I've created, which can have a number of child controls - also user controls - stored as an ArrayList, which can be added wither a design time or programmatically.My problem is when I add to the list programmatically, it doesn't persist them. So if I add 3 child controls in step 1 of a wizard, with the aim that those three will be visible inside the parent in step 3, what happens is that the parent has no child controls and the item count is 0.Can anyone help? Thanks in advance.Code:Parent Control Markup: <%@ Control Language="C#" Auto...

web controls and web user control
i have a problem in a web form , I have a webform that contains a web user control which in turn contains a html input form ,the web control events don't fire up ,When I click button ,no effect ,I don't know what is the effect of the html form which is in the web user control on the web controls in the web form ?? can any one help me the web control event should be handle in the code behind page, is the event handler for the button you are clicking registered? You can try double clicking the button, should give you the default btn_click event handler in code behind. Also, make ...

Use Web Control In a Web Control
Is this possible?I am working with an aspx page that consists of many different web controls.One of the web controls contains search criteria.  One of the criteria is a date range where I am trying to add a popup calendar --> which is another web controlCan I register the popupcaledar control on the questionaire control?  I have tried, but nothing seems to be registered.Any ideas will GREATLY help.Relax and have some Home Brew!Prosecute the Owner - Don't PERSECUTE the Breed!Breed Specific Legislation targets the WRONG end of the LEASH! Without seeing your code we can'...

Using Registered Controls from Web User Controls as if a Page
If you look at the snippet below you will see that I have registered all these control sets to my pages so when in the design view I can type away happily and have access to my AjaxControls, Render Controls and Lang controls. Problem is Im using alot of Web User Controls, which when in the design view of the web User Controls, these same controls do not show up in the quick menu. which makes life a little more frustrating than it should be. How do I get these to work? -Hope that makes sense.<system.web><pages>               &...

Web resources about - I have a web user control being used by another web user control, but the one being used will not display the labels in the resx file. - asp.net.dotnetnuke

Control - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

WA bushfires: Firefighters work through the night to control several blazes
Firefighters in Western Australia are working through the night to control and contain several blazes.

Alaska Marijuana Control Board votes to allow consumption in retail outlets - Alaska Dispatch News
The Alaska Marijuana Control Board voted Friday to allow consumption of marijuana products in retail stores across the state. But social clubs, ...

69 percent of users would bypass security controls to win a big deal
When faced with the chance of clinching a major deal people are willing to throw security controls out of the window. This is according to research ...

MAZEL TOV, HILLARY: Clinton Wins Gun Control Award From Major Anti-Bill of Rights Group
... restrictions on the freedoms protected by the Constitution is not a sign of character, but a clear indication of blind adherence to a gun control ...

Obama to Veto Bill Requiring Background Checks On Syrian Refugees; France Demands Tighter Controls, EU ...
... does not call for ending the refugee program or require religious screenings, as some Republicans have demanded . France Demands Tighter Controls, ...

Brussels Pushes Gun Control In Wake of Paris Attacks
Europeans double down on gun control after terrorists murder defenseless civilians

Control Your HTPC With Scavenged IR Parts
If you’ve built yourself a home theater PC, one of your highest priorities is probably coming up with a convenient control solution. The easiest ...

ICYMI: Even the AP couldn’t validate any of Hillary’s gun control nonsense
... – not 200 as she claimed . Asked to explain the discrepancy, Clinton’s campaign pointed to 2013 statistics from the Centers for Disease Control ...

5 Questions: Punjab’s rightful control over Chandigarh, says Prem Singh Chandumajra
Shiromani Akali Dal (Badal) MP Prem Singh Chandumajra on why he raised the issue of Punjab’s claim over Chandigarh in LS.

Resources last updated: 11/25/2015 6:37:09 AM