attributes

Make attributes incompatible with each other?

Is there a simple way to make my attributes incompatible with each other? C# .net ...

How would one create wrappers for property attributes?

In ASP.NET MVC we can use the System.ComponentModel.DataAnnotations namespace to assist with form/ model input validation. If I didn't want to be tied to any specific framework i.e. xVal, EntLib Val Block, etc. and I wanted to create basically a wrapper classes to protect my code from the direct dependency how would one accomplish that...

jquery: radio button input checked attribute is undefined

I have the following and in this order: <script type="text/javascript"> $(document).ready(function(){ var overwrite = $('#itemList input:radio:checked').val() alert('value = '+ overwrite); }); </script> <body> <form ..... > <div id="itemList"> Overwrite? <input type="radio" value="Yes" class="overWrite" nam...

Interfaces or Attributes for Tagging Classes?

I have a couple of classes that I wish to tag with a particular attribute. I have two approaches in mind. One involves using an Attribute-extending class. The other uses an empty interface: Attributes public class FoodAttribute : Attribute { } [Food] public class Pizza { /* ... */ } [Food] public class Pancake { /* ... */ } if (obj....

Change assembly attribute values after the build in .Net

I want to change the assembly attribute like AssemblyTitleAttribute value to something else once the build is done. Is this possible? Its just that we have two types of builds one is base and the other is obfuscated, so we just want to add some changes to title / attribute values without rebiulding the assemblies. ...

Why can't I comment attributes in XAML?

This has been bothering me for a while, maybe I am missing something. The following throws an error with the commented attribute (expected >), but shouldn't I be able to do something like this? <Label x:Name="Gaga" FontSize="20" <!-- Content="{Binding SomethingThatIsEmptyAtDesignTime"} ...

MVC Model Validation Programmatic Registration support

Today (15th Jan 2010) Scott blogged about the ASP.NET MVC2 model-validation http://weblogs.asp.net/scottgu/archive/2010/01/15/asp-net-mvc-2-model-validation.aspx Anyone knows how can someone add validation rules at runtime programmatically ? "Programmatic Registration" is a similar functionality supported by ValidationAspects // regi...

Can I get a custom sorted EntityCollection by default in EntityFramework ?

Hi, I would like to call a method in the ObjectContext which returns EntityCollection and have it sorted the way I want by default. For example, Imagine I have the following Category table/class: CategoryID (PK) Name ParentID (FK_Category) foreign key pointing to CategoryID itself. (This table is the base for a tree structure of Cate...

[C#] Is XmlRootAttribute inheritable?

I have a class I am serializing with C#'s XmlSerializer. It is marked with the XmlRoot attribute, and I would like to inherit this attribute in a derived class. Looking at the documentation it does not say that XmlRoot sets Inherit to false with AttributeUsageAttribute (Inherit is supposed to default to true), but I get an error when tr...

What .Net attributes do people apply to their code?

Possible Duplicate: Most Useful Attributes in C# I always feel that I am missing functionality that can be gained in .Net by simply applying attributes to classes, methods, properties etc. It doesn't help that intellisense cannot display all appropriate attributes as they can normally be applied in a wide range of scenarios. He...

jQuery attr is not working

I have image in container and I have set width and height attributes for this image in CSS. But I need to add loading image and it is smaller than actual pictures that will be shown in container, so I need to change size of image while it is loading. But when I set width and height attributes, image is shown in size that is set in CSS. ...

Are there good reasons for letting AssemblyVersion and AssemblyFileVersion match?

Gendarme has an AvoidAssemblyVersionMismatchRule with the following description: This rule checks that the [AssemblyVersion] matches the [AssemblyFileVersion] when both are present inside an assembly. Having different version numbers in both attributes can be confusing once the application is deployed. For example, this rule would ...

Identifying a certain node in XML

<enviNFe versao="1.10"> <idLote>000000000000094</idLote> <NFe> <infNFe Id="NFe35090254517628000198550010000000011870030005" versao="1.10"> <!-- ... content ... --> </infNFe> <Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt; <!-- ... content ... --> </Signature> </NFe> </enviNFe> I have this XML fi...

HTML: Is it valid to set img src="about:blank"?

Background: I need to have an inline element to which I can apply width and height via CSS. AFAIK, img is the only way to have this behavior, currently. I would rather not have the image point to a transarent pixel GIF on the server. It may be cached, but browsers queue it nevertheless, slowing down overall page speed. Other clients mig...

Compelling Reasons to Use Marker Interfaces Instead of Attributes

It's been discussed before on Stack Overflow that we should prefer attributes to marker interfaces (interfaces without any members). Interface Design article on MSDN asserts this recommendation too: Avoid using marker interfaces (interfaces with no members). Custom attributes provide a way to mark a type. For more information ab...

JQuery : selector chain with attribute filter : result does not persist?

I am pulling my hair out!! grrr... This seems to work: //get all the foo and bar links that point to a named anchor: $("a.foo,a.bar").filter("[href^=#]").click ( function() { doSomething( $(this).attr("href").substr(1) ); return false; } ); When I log the output of '$(this).attr("href").substr(1)' to the c...

Howto use variable attribute for Jquery lightbox plugin

Hello, I try to implement the JQuery Lightbox plugin with dynamic grouped of images (grouped in image popup), but i can not find the clue for popup grouped images. Can someone tell me what i'm doing wrong? HTML <a href="pic1.jpg" class="pic" rel="lightbox1"><img src="pic1.jpg"/></a> <a href="pic2.jpg" class="pic" rel="lightbox1"><img...

Replace link location (jQuery)

<a href="http://www.google.com"&gt;link&lt;/a&gt; How do I replace link location from google.com to say "#"? $('a').attr( 'href', '#' ); isn't working. ...

How can I match the xmlns:* attributes with XSLT ?

How can I match the xmlns:* attributes with XSLT 1.0 ? Using a RDF document I tried: <xs:template match="rdf:RDF"> (...) <xsl:for-each select="@*"> <xsl:value-of select="."/> </xsl:for-each> (...) </xsl:template> but it doesn't seem to work for the xmlns attributes. Thanks. ...

Retrieving Custom Attribute on a web page class (.net)

I've create a custom attribute for my web pages... In the base page class I've created I'm trying to pull if that attribute has been set. Unfortunately it does not come back as part of the GetCustomAttributes function. Only if I explicitly use the typeof(myclass) to create the class. I have a feeling it's due to how asp.net classes a...