componentmodel

How to disable designer in derived classes in following generations

夙愿已清 提交于 2020-01-01 04:51:06
问题 In order to disable component designer in classes it is simple to add just [System.ComponentModel.DesignerCategory("")] attribute to it, however it does not work for any classes derived from this class in any generation. E.g: [System.ComponentModel.DesignerCategory("")] public class A:ServiceBase { } //Designer is disabled here public class B:A {} //Designer is enabled here [System.ComponentModel.DesignerCategory("")] public class B:A {} //Designer is enabled here too [System.ComponentModel

Can I use other attribute arguments than numbers in DataAnnotations.StringLength?

房东的猫 提交于 2019-12-11 10:17:01
问题 I have a (Settings) class that contains all hardcoded code. It's really handy for certain fields such as maxCharactersFields and error messages, this way I can use the same field for mapping, models & viewmodels. Therefore if it were to change it the future, everything changes the same way. However, I cannot seem to use this in viewmodels. More specifically in StringLength of System.ComponentModel.DataAnnotations. The error it gives is "An attribute argument must be a constant expression,

Removing Required Attribute from Class but MVC3 still won't post the form without a value in the text box

孤街醉人 提交于 2019-12-01 00:28:51
问题 I have a class. At one point, I had set the properties of the class to [Required] using System.ComponentModel.... Okay, then I realized this was not needed. I have removed the required property but when I try to submit the form to an ActionResult the form does NOT post and still is trying to enforce the TextBoxFor(theModelProperty) to be populated. I have deleted the "obj" folder, the "bin" folder, and also "Cleaned" the solutions. Still NO resolution. I don't want to do a stupid workaround,

What is the difference between IEditableObject and IRevertibleChangeTracking?

我的未来我决定 提交于 2019-11-30 11:55:39
问题 What is the difference between IEditableObject and IRevertibleChangeTracking (both from the System.ComponentModel namespace)? It looks as if the first supports explicit transaction whilst the second is more implicit - but the net result is the same. How should I go about implementing this in code? At the moment I do nothing in BeginEdit and call RejectChanges and AcceptChanges in EndEdit and CancelEdit respectively. My problem is that this will also accept the changes made prior to the

What is the difference between IEditableObject and IRevertibleChangeTracking?

前提是你 提交于 2019-11-30 02:03:20
What is the difference between IEditableObject and IRevertibleChangeTracking (both from the System.ComponentModel namespace)? It looks as if the first supports explicit transaction whilst the second is more implicit - but the net result is the same. How should I go about implementing this in code? At the moment I do nothing in BeginEdit and call RejectChanges and AcceptChanges in EndEdit and CancelEdit respectively. My problem is that this will also accept the changes made prior to the BeginEdit. Is that really what Microsoft wanted or am I trying to implement two mutually exclusive interfaces

Programmatically Hide Field in PropertyGrid

心已入冬 提交于 2019-11-28 11:42:20
Using <System.ComponentModel.TypeConverter(GetType(System.ComponentModel.ExpandableObjectConverter))> _ on the declaration of a class (which is a property of another class) that consists of a number properties. I load an instance of this class with simply ... PropertyGrid1.SelectedObject = oColumn Obviously I don't want to manually build the propertygrid in code, I know how to do that. But here's the problem. Depending on the value of a property, certain other properties should not be visible, as though I'd used the <System.ComponentModel.Browsable(False)> _ attribute on the property

ASP.NET MVC3: ValidationType ModelClientValidationRule

拥有回忆 提交于 2019-11-28 04:09:25
问题 I just created a sample MVC3 application to learn validation. It is using DataAnnotations. I have created a custom ValidationAttribute named CustomStartLetterMatch. It is implementing “System.Web.Mvc.IClientValidatable”. I have corresponding client-side code written with unobtrusive jQuery. This is working as expected. About the custom validator: It compares the first name input and last name input. It throws error if first character of both of them are not same. As I said, the application is

Programmatically Hide Field in PropertyGrid

穿精又带淫゛_ 提交于 2019-11-27 06:24:08
问题 Using <System.ComponentModel.TypeConverter(GetType(System.ComponentModel.ExpandableObjectConverter))> _ on the declaration of a class (which is a property of another class) that consists of a number properties. I load an instance of this class with simply ... PropertyGrid1.SelectedObject = oColumn Obviously I don't want to manually build the propertygrid in code, I know how to do that. But here's the problem. Depending on the value of a property, certain other properties should not be visible