Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Build error with generated language resx files

Posted on 2008-10-16
5
Medium Priority
?
808 Views
Last Modified: 2013-12-17
I generated resource files for usercontrols in a dedicated map. Now when I build, there is the 'object reference not set to an instance of an object' error that holds on a line with the meta:lblSomethingResource1.

When I remove that line, it shows the error for the next meta.

I tried with another web.config file that works for another site, but with no success.

the attached code is just an example of the first control. It happens with all controls.
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucAnnounce.ascx.cs" Inherits="backoffice_userControls_ucAnnounce" %>
 
<asp:HyperLink ID="hlNew" runat="server" NavigateUrl="~/backoffice/EventAnounceEdit.aspx?filename=new&eventID=" Text="Nieuw bestand" meta:resourcekey="hlNewResource1" />
 
<asp:GridView ID="gvList" runat="server" AutoGenerateColumns="False" Width="90%" AlternatingRowStyle-BackColor="#EEEEEE" meta:resourcekey="gvListResource1">
    <Columns>
        <asp:TemplateField meta:resourcekey="TemplateFieldResource1">
            <ItemTemplate>
                <asp:HyperLink ID="hlPage" runat="server" Target="_blank" Text='<%# MakeFullURL(Convert.ToString(Eval("Name"))) %>' NavigateUrl='<%# MakeFullURL(Convert.ToString(Eval("Name"))) %>' meta:resourcekey="hlPageResource1" />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField meta:resourcekey="TemplateFieldResource2">
            <ItemTemplate>
                <asp:Label ID="lblName" runat="server" Visible="False" Text='<%# Eval("Name") %>' meta:resourcekey="lblNameResource1" />
                <asp:ImageButton ID="lbEdit" runat="server" ImageUrl="~/backoffice/images/icon_edit.gif" OnClick="lbEdit_Click" meta:resourcekey="lbEditResource1" />&nbsp;
                <asp:ImageButton ID="lbDelete" runat="server" ImageUrl="~/backoffice/images/icon_close.gif" OnClick="lbDelete_Click" meta:resourcekey="lbDeleteResource1" />
            </ItemTemplate>
            <ItemStyle HorizontalAlign="Right" />
        </asp:TemplateField>
    </Columns>
    <AlternatingRowStyle BackColor="#EEEEEE" />
</asp:GridView>
<asp:Label ID="lblEmpty" runat="server" Text="<br />U hebt momenteel geen announce pagina's<br />" Visible="False" meta:resourcekey="lblEmptyResource1" />
<br />
<asp:HyperLink ID="hlNew2" runat="server" NavigateUrl="~/backoffice/EventAnounceEdit.aspx?filename=new&eventID=" Text="Nieuw bestand" meta:resourcekey="hlNew2Resource1" />

Open in new window

0
Comment
Question by:corcon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 16

Expert Comment

by:Gyanendra Singh
ID: 22738294
from which resource file you are getting this key meta:lblSomethingResource1

refre this for details
http://www.codeproject.com/Kb/aspnet/localizationByVivekTakur.aspx
0
 

Author Comment

by:corcon
ID: 22738507
I'm sorry, bad example, of course it must be like this: meta:resourcekey="hlNewResource1" (like in the example)

This is generated by Tools > Generate local resources

So it is the corresponding file in the App_LocalResources directory with filename ucAnnounce.ascx.resx

I did this a million times, but this is the first time it won't build because of this error.
0
 
LVL 16

Accepted Solution

by:
Gyanendra Singh earned 1500 total points
ID: 22738609
You are probably calling Localization from somewhere in your code. If you are doing that, it's going to need the file and strings mapped to the ones that are being localized.
0
 

Author Comment

by:corcon
ID: 22738786
Yes, in the main site (1 directory up), there is indeed other localization code.

Damn, didn't see that one.

Can I use a different web.config for the underlying path or isn't there a way around to use that one to?
0
 

Author Closing Comment

by:corcon
ID: 31506697
Tnx to point me out on this, but it would be nice if I knew how to solve this without using the used translationtool.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question