Problem:
I have the following property on my entity framework designer that I want to make it ReadOnly:
[global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]Solution:
[global::System.Runtime.Serialization.DataMemberAttribute()]
public int FilterParameterId
{
get
{
return this._FilterParameterId;
}
set
{
// etc
}
}
1.
Make two copies of the Text.ascx field template and name one ReadOnlyText.ascx (is used on edit page and list) and the other ReadOnlyText_Edit.ascx (is used on Insert page) then annotate the field as follows
2.
[MetadataType(typeof(FilterParameter_MD))]
public partial class FilterParameter
{
}
public class FilterParameter_MD
{
[UIHint("ReadOnlyText")]
public object FilterParameterId { get; set; }
}
No comments:
Post a Comment