Questions tagged [custom-attributes]

In .NET Framework, custom attributes are user defined attributes which enable providing metadata for application elements such as assemblies, classes and methods.

In .NET Framework, custom attributes are user defined attributes which enable providing metadata for application elements such as assemblies, classes and methods.

1173 questions
0
votes
1 answer

How to create a custom attributes that derive from AuthorizeAttribute?

After a user has create an account, he/she needs to create a profile where he/she submits some information that will be used letter. I have 2 such controllers that need information from the user's profile. I'm trying to create an attribute that…
Richard77
  • 20,343
  • 46
  • 150
  • 252
0
votes
1 answer

CustomAttribute that validates 2 fields

So i have these 2 input fields Fromdate and ToDate, In MVC I want to create a CustomAttribute to ensure Fromdate is before ToDate. Is this possible? if so how? or what is the alternative? Thanks
raklos
  • 28,027
  • 60
  • 183
  • 301
0
votes
1 answer

i would like to explore attributes as means for branding. How do I create/use my own attributes

In MVC, you can decorate a property with values that can be read out by the Html helpers. For example Html.LabelFor() reads out the display attribute of a property. What I am wondering, is it possible to do this for a complete value? I'm exploring…
Sinaesthetic
  • 11,426
  • 28
  • 107
  • 176
0
votes
1 answer

RIA Services Class Library and Custom Attributes not generated

I have a Solution with different Projects: A Silverlight Class Library: - In this I have a "Link" to the CS File with Attribute wich is used on a DTO - In this Class there is also a modified Datagrid wich uses the Attribute A RIA Class Library: …
Jochen Kühner
  • 1,385
  • 2
  • 18
  • 43
0
votes
2 answers

Rename Property from Deserialized Javascript

How do I take deserialize JavaScript and change the name of the property being processed? For example: class MyClass { public string CreateDate {get;set;} } public class DeserializeMyClass { //How do I take "create_date" and convert it to…
elucid8
  • 1,412
  • 4
  • 19
  • 40
0
votes
0 answers

Choose between attributes at runtime

I have a service interface that requires different attributes in different situations. In short there are two options: [DispatchByBodyElementBehavior] public interface FooPortType { [OperationContractAttribute(Action = "", ReplyAction = "*")] …
Miel
  • 3,347
  • 2
  • 26
  • 39
0
votes
1 answer

javascript - testing against custom attributes in loop

I have a form that I set up as a quiz to take. Eventually I will alter it to calculate the final score of the quiz once done. But I am stuck on this one part. I want to add a point if a right box is checked, and subtract a point if a wrong box is…
xjsc16x
  • 278
  • 1
  • 6
  • 16
0
votes
4 answers

Dynamically convert a list of properties into an object

I'm prototyping an automated way to declare routes in C# MVC(4) applications, so I decided to use custom attributes for controller's methods: [RouteUrl("foo/{param}")] [RouteConstraint("param", "[a-z]+[0-9]+")] public ActionResult MyAction(string…
Profet
  • 944
  • 1
  • 15
  • 22
0
votes
1 answer

How to create Custom Authorization attribute?

I am trying to implement a custom authorize attribute on my mvc4 app with parameters. What I am trying to achieve is this: [Authorize(Application == "Initialize,Start,..." , Topic == "foo1,foo2,foo3...")] public ActionResult Edit(int id) { …
0
votes
1 answer

Custom authorize attribute - can I store a value for later?

I have a custom authorize attribute, which basically simply verifies that a cookie was sent with the request and that it has a value assigned. public override void OnAuthorization(AuthorizationContext filterContext) { if…
Zholen
  • 1,762
  • 2
  • 24
  • 53
0
votes
1 answer

Im am trying to create custom authorize attribute on my web api mvc 4 application in visual basic

I am trying to implement my custom authorize attribute that inherits system.web.http.authorizeAttribute in my project i have a web api mvc 4 template and a mvc4 internet application template with windows authentication as a client. i have some…
0
votes
1 answer

custom cursor in adobe edge

i am trying to make an custom cursor in adobe edge, without much sucess so i hope someone could help me. these are the codes that i have tried; var myCursor = new ball();// as linkage to be done in the…
0
votes
1 answer

MVC4 - Why is my URL rewrite preventing me from accessing the ID in a custom AuthoriseAttribute

I am currently writing an Authorisation filter in MVC4, it has the default URL rewrite routes.MapRoute( name: "Default", url: "{controller}/{action}", defaults: new { controller = "Home", action = "Index", id =…
m.t.bennett
  • 1,290
  • 16
  • 34
0
votes
1 answer

Understanding validity in a model where a property has more than one validation attribute

I'm working on an MVC app, and a bit of model code I've written has unfolded somewhat like this: public class SomeModel { public int? CodeA { get; set; } public int? CodeB { get; set; } [RequiredIf("CodeA", 3, ErrorMessage = "(required…
Andrew Gray
  • 3,756
  • 3
  • 39
  • 75
0
votes
1 answer

Magento - Displaying custom attribute in accounts area (front-end)

I have used this module creator to get an custom attribute (which takes the type 'file'). http://www.silksoftware.com/magento-module-creator/ This works and can be seen in the admin area. I also have other custom attributes for customers which I…
user1669256
  • 151
  • 1
  • 1
  • 10