Re: Partial Classes, .Net 2.0 and Custom Attributes
- From: Brock Allen <ballen@xxxxxxxxxxxxxxxxx>
- Date: Wed, 07 Sep 2005 09:28:10 -0700
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/ballenYes 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/ballenThanks 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/ballenHi,
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.
.
- References:
- Re: Partial Classes, .Net 2.0 and Custom Attributes
- From: Julian Jelfs
- Re: Partial Classes, .Net 2.0 and Custom Attributes
- Prev by Date: Re: MasterPages and Variables
- Next by Date: Re: Image Buttons not working after clicking one button once
- Previous by thread: Re: Partial Classes, .Net 2.0 and Custom Attributes
- Next by thread: Hide Hyperlinks Visitors?
- Index(es):
Relevant Pages
|