Solved

Build error with generated language resx files

Posted on 2008-10-16
5
785 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
  • 3
  • 2
5 Comments
 
LVL 16

Expert Comment

by:Gyanendra Singh
Comment Utility
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
Comment Utility
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 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now