Re: Partial Classes, .Net 2.0 and Custom Attributes

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Yeah, that's why I suggested looking into your own custom Expression Builders. Sounds like that's a perfect fit for your needs.

-Brock
DevelopMentor
http://staff.develop.com/ballen



Well, the problem is that I don't really want it to be tied to
culture. So it's not really localization in that sense, it's rather
the ability to provide alternative sets of terminology (which might
include a separate langyage altogether)  So I might have two different
sets of terminology being used within the same culture setting. That's
really why I thought that the language localization infrastructure
provided by the .Net framework didn't quite fit.

I also need to store my resources in a database rather than resource
files, but I think .Net 2 allows that right?

"Brock Allen" wrote:

Agreed.

Let me ask why the built-in localization scheme doesn't work for you?
If you need more control over it you can build your own expression
builder such that you get to define your own <%$ %> syntax in the
pages. That would then invoke your code to do your own conditional
localization.....

-Brock
DevelopMentor
http://staff.develop.com/ballen
Yes that's an idea I could try. It all starts to get a bit laborious
then.

"Brock Allen" wrote:

The only other thing I could suggest is making a property on your
page which sets the text on the Label and then aoontate thge
property w/ your custom attribute.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Thanks for the response. I have looked into the Asp 2 localization
model and it doesn't quite do what I want it to.

It seems like a bit of a problem that it is impossible to add an
attribute to a control added declaratively in design view. I can't
believe there's no way to do it. I do want to do things the 2005
way in every other regard because it's easier and better.

"Brock Allen" wrote:

If you need to add a custom attribute to the field, then don't
use partial classes and the new CodeFile directive. I think
you're going to have a struggle though, as the new VS.NET model
doesn't want to do things the old way :)

BTW, since your attribute is called [Localize] I'm wondering if
the new localization model in 2.0 will suit your needs:

http://beta.asp.net/QUICKSTART/aspnet/doc/localization/default.as
px

-Brock
DevelopMentor
http://staff.develop.com/ballen
Hi,

I had an aspx pag in .Net 1.1 with a label on it. As such I had
a code behind page with a declaration for that label.

When I convert to Asp.Net 2.0 the code behind is converted to a
partial class and the declaration for the label is removed. This
is what I expected to happen and I understand why it has
happened.

The problem I have is that I had added a custom attribute to my
label declaration which I use to handle localization. e.g.

[Localize]
protected System.Web.UI.WebControls.Label lScreenTitle;
Since that declaration has been removed, so has the custom
attribute.
My question is, how do you add a custom attribute to a control
on
an
aspx page in Asp.Net 2.0 given that you no longer have access to
the
control's declaration in the code-behind file?
Thanks,
Julian Jelfs.




.



Relevant Pages

  • Re: Partial Classes, .Net 2.0 and Custom Attributes
    ... The only other thing I could suggest is making a property on your page which sets the text on the Label and then aoontate thge property w/ your custom attribute. ... partial class and the declaration for the label is removed. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Partial Classes, .Net 2.0 and Custom Attributes
    ... I had an aspx pag in .Net 1.1 with a label on it. ... class and the declaration for the label is removed. ... Since that declaration has been removed, so has the custom attribute. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Partial Classes, .Net 2.0 and Custom Attributes
    ... > If you need to add a custom attribute to the field, ... since your attribute is called I'm wondering if the new localization ... >> partial class and the declaration for the label is removed. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Partial Classes, .Net 2.0 and Custom Attributes
    ... If you need to add a custom attribute to the field, then don't use partial classes and the new CodeFile directive. ... partial class and the declaration for the label is removed. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Adding Avery Label Definitions
    ... Graham Mayor - Word MVP ... just because custom label definitions aren't stored in the ... Note that if you update to Word 2007 the whole game stops as custom ... Most organisations only use one or two label sizes. ...
    (microsoft.public.word.docmanagement)