Search Results

Search found 12126 results on 486 pages for 'property hiding'.

Page 77/486 | < Previous Page | 73 74 75 76 77 78 79 80 81 82 83 84  | Next Page >

  • How come module-level validators are evaluated only after property-level validators?

    - by jonathanconway
    I'm using the module-level validator: 'PropertiesMustMatch' on my view-model, like so: [PropertiesMustMatch("Password", "PasswordConfirm")] public class HomeIndex { [Required] public string Name { get; set; } public string Password { get; set; } public string PasswordConfirm { get; set; } } I'm noticing that if I submit the form without Name filled in, the ValidationSummary() helper returns only the following error: The Name field is required. However, if I fill in Name, then ValidationSummary() will return a PropertiesMustMatch error: 'Password' and 'PasswordConfirm' do not match. So it looks like the property-level validators are being evaluated first, then the model-level validators. I would much prefer if they were all validated at once, and ValidationSummary would return: The Name field is required. 'Password' and 'PasswordConfirm' do not match. Any ideas what I can do to fix this? I'm studying the MVC 2 source-code to try to determine why this happens.

    Read the article

  • How come the Name property is <Unknown> on a FileStream which uses handle constructors?

    - by Mikael Svenson
    Say you get a file handle from some outside DLL and instantiate a FileStream with it. It works just fine for reading and writing. Then you want the path and name of that handle and try to access the Name property of your FileStream object, and it returns 'unknown'. This is true for the constructors which takes file handles: public FileStream(IntPtr handle, ... public FileStream(SafeFileHandle handle, ... I know the short answer, because it's not implemented. The private field _fileName of FileStream is never assigned in those constructors. Seems the API to get the name from a handle involves more than one line of code, but I still think they could have bothered to include this. So the real questions is: Why haven't they? Or did they just forget?

    Read the article

  • Why does an onclick property set with setAttribute fail to work in IE?

    - by Aeon
    Ran into this problem today, posting in case someone else has the same issue. var execBtn = document.createElement('input'); execBtn.setAttribute("type", "button"); execBtn.setAttribute("id", "execBtn"); execBtn.setAttribute("value", "Execute"); execBtn.setAttribute("onclick", "runCommand();"); Turns out to get IE to run an onclick on a dynamically generated element, we can't use setAttribute. Instead, we need to set the onclick property on the object with an anonymous function wrapping the code we want to run. execBtn.onclick = function() { runCommand() }; BAD IDEAS: You can do execBtn.setAttribute("onclick", function() { runCommand() }); but it will break in IE in non-standards mode according to @scunliffe. You can't do this at all execBtn.setAttribute("onclick", runCommand() ); because it executes immediately, and sets the result of runCommand() to be the onClick attribute value, nor can you do execBtn.setAttribute("onclick", runCommand);

    Read the article

  • Can the get of a property be abstract and the set be virtual?

    - by K. Georgiev
    I have a base class like this: public class Trajectory{ public int Count { get; set; } public double Initial { get; set { Count = 1; } } public double Current { get; set { Count ++ ; } } } So, I have code in the base class, which makes the set-s virtual, but the get-s must stay abstract. So I need something like this: ... public double Initial { abstract get; virtual set { Count = 1; } } ... But this code gives an error. The whole point is to implement the counter functionality in the base class instead in all the derived classes. So, how can I make the get and set of a property with different modifiers?

    Read the article

  • How to instanciate a class when its property members are not of primitive types?

    - by Richard77
    Hello, 1) Let's say I've a class MyDataInfo public class MyDataInfo { public int MyDataInfoID { get; set; } public string Name { get; set; } } For the purpose of the fuctionality I'm after, I've created another class (MyData) whose property members are of MyDataInfo type. 2) Here's myData public class MyData { public MyDataInfo Prop1 { get; set; } public MyDataInfo Prop2 { get; set; } } 3) And, here's my action method public ActionResult MyAction() { MyData myObject = new MyData(); return View(myObject); } 4) Finally, this in my View template (which is strongly typed and inherits from MyData) <% = Html.Encode (Model.Prop1.Name)%> <% = Html.Encode (Model.Prop2.Name)%> Unfortunately, I got an error "Object not set to an instance of an object." Am I missing something or is there a different way of obtaining the same result? Thanks for helping

    Read the article

  • [ASP.NET] A CustomValidator doesn't need to have it's ControlToValidate property set, so...

    - by pkiyan
    Hi: I've just finished reading up on the CustomValidator control and I have a question. In the book I'm reading, it says that a CustomValidator doesn't need to have it's ControlToValidate property set and it gives a few examples of that usage. But in one example where ControlToValidate isn't used, the OnServerValidate function has a timer (5 seconds) that you need to beat by entering your 'answer' into a textbox. If it takes you longer than 5 seconds, the CustomValidator's error message pops up next to the textbox (it's like a timed question/answer game) . How did the CustomValidator know to place the message next to the textbox (there's no association between the two, that I know of)? I wanted to test this, so I put a couple more textboxes on the page and the error message always showed up next to the last textbox I placed on the page. Thanks.

    Read the article

  • How do I fix "error 1004, 0, Unable to find property" in an Entity Framework 4 WinForms application?

    - by Ivan
    I've designed an EF4 model (quite complex inheritance, lots of small tables incl. multiple self-referencing), generated (table-per-type) a database and inserted some basic data manually. It works fine in an ASP.Net Dynamic Data Entities web application with full automatic scaffolding. But when in a WinForms application using the same model (I share it as a part of a class library) I construct a query and bind a combo box to it (the way it's shown here), I get an InnerException {"Internal .NET Framework Data Provider error 1004, 0, Unable to find property... I've found a question about the same problem here (incl. a sample to reproduce the error) but no answer. I use final Visual Studio 2010, no beta.

    Read the article

  • What does this exception mean? and how do i solve this? java

    - by Nitesh Panchal
    Hello, I am using IcePDF component to view pdf in JApplet on my web page. But for some reason i get this error. Can anybody tell why is this happening and how to solve it? Exception in thread "thread applet-applet.KitKitApplet.class-1" java.lang.StackOverflowError at java.util.PropertyPermissionCollection.implies(Unknown Source) at java.security.Permissions.implies(Unknown Source) at sun.security.provider.PolicyFile.implies(Unknown Source) at java.security.ProtectionDomain.implies(Unknown Source) at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPropertyAccess(Unknown Source) at java.lang.System.getProperty(Unknown Source) at org.icepdf.core.util.Defs.property(Defs.java:59) at org.icepdf.core.util.Defs.property(Defs.java:63) at org.icepdf.core.util.Defs.property(Defs.java:63) at org.icepdf.core.util.Defs.property(Defs.java:63) at org.icepdf.core.util.Defs.property(Defs.java:63) at org.icepdf.core.util.Defs.property(Defs.java:63) at org.icepdf.core.util.Defs.property(Defs.java:63)

    Read the article

  • Why can I not add a set accessor to an overriden property?

    - by Svish
    In a base class I have this property: public virtual string Text { get { return text; } } I want to override that and return a different text, but I would also like to be able to set the text, so I did this: public override string Text { get { return differentText; } set { differentText = value; } } This however does not work. I get a red squiggly under set saying that I can not override because it does not have a set accessor. Why is this aproblem? What should I do?

    Read the article

  • How to set a property of a C# 4 dynamic object when you have the name in another variable

    - by Kieran Benton
    I'm looking for a way to modify properties on a dynamic C# 4.0 object with the name of the property known only at runtime. Is there a way to do something like (ExpandoObject is just used as an example, this could be any class that implements IDynamicMetaObjectProvider): string key = "TestKey"; dynamic e = new ExpandoObject(); e[key] = "value"; Which would be equivalent to: dynamic e = new ExpandoObject(); e.TestKey = "value"; Or is the only way forward reflection?

    Read the article

  • How do I get property injection working in Ninject for a ValidationAttribute in MVC?

    - by jaltiere
    I have a validation attribute set up where I need to hit the database to accomplish the validation. I tried setting up property injection the same way I do elsewhere in the project but it's not working. What step am I missing? public class ApplicationIDValidAttribute : ValidationAttribute { [Inject] protected IRepository<MyType> MyRepo; public override bool IsValid(object value) { if (value == null) return true; int id; if (!Int32.TryParse(value.ToString(), out id)) return false; // MyRepo is null here and is never injected var obj= MyRepo.LoadById(id); return (obj!= null); } One other thing to point out, I have the Ninject kernel set up to inject non-public properties, so I don't think that is the problem. I'm using Ninject 2, MVC 2, and the MVC 2 version of Ninject.Web.MVC. Thanks!

    Read the article

  • MDX query- How do I use a member property?

    - by WaggingSiberian
    I'm a complete newb to MDX / OLAP, "data warehousing" in general. I have the following MDX query and would like my results to display the month's number (1 = January, 12 = December). Luckily, the cube creator create a member property named "Month Number Of Year" When I try to run the query, I get the following... "Query (4, 8) The function expects a tuple set expression for the 1 argument. A string or numeric expression was used." Any suggestions for fixing this? Thanks! WITH MEMBER [Measures].[Tmp] as '[Measures].[Budget] / [Measures].[Net Income]' SELECT {[Date].[Month].Properties("Month Number Of Year")} ON COLUMNS, {[Measures].[Budget],[Measures].[Net Income],[Measures].[Tmp]} ON ROWS FROM [AnalyticsCube]

    Read the article

  • Howto write a class where a property can be accessed without naming it.

    - by SchlaWiener
    I have a (dump) question regarding VB/C# I often use third party classes where I can access a child object with only specifying the id or key. Example: Instead of writing: DataRow row = GetAPopulatedDataRowSomeWhere(); Object result = row.Items[1]; // DataRow has no Items property Object result = row.Items["colName"]; // Also not possible I use this code to access the members: DataRow row = GetAPopulatedDataRowSomeWhere(); Object result = row[1]; Object result = row["colName"]; Can someone tell me how a class has to look like to support this syntax? My own class has a Dictionary that I want to access this way. MyClass["key"]; // <- that's what I want MyClass.SubItems["key"]; // <- that's how I use it now

    Read the article

  • Sharepoint 2010, get the Distinct Values of a User Profile Property?

    - by Michael Stum
    Is there any way in SharePoint 2010 to get the Distinct values of a property accross all users? For example, I want a list of all Departments in the Profile Store. In SQL I can do SELECT DISTINCT(PropertyVal) FROM [ProfileDB].[dbo].[UserProfileValue] WHERE PropertyID = 14 but accessing the SQL Database is a big no-no of course, so I wonder if there is something in the object model? Note that accessing the User Information List on an SPSite is not good enough, as only a fraction of all users is in that list. I want to get it directly from the Profile Store.

    Read the article

  • How to hide editor-label for public property when calling EditorFor(...)?

    - by FreshCode
    When calling Html.EditorFor(m => m), where m is a public class with public properties, a hidden input and a label are displayed for properties with the [HiddenInput] attribute. How can I hide the label without making it private or creating an editor template? Example public class User { [HiddenInput] public Guid ID { get; set; } // should not be displayed in editor template public string Name { get; set; } // should be editable } Undesired result for ID property by EditorFor(...) with label <div class="editor-label"> <label for="ID">ID</label> <!-- Why is this here? --> </div> <div class="editor-field"> <input id="ID" name="ID" type="hidden" value=""> </div>

    Read the article

  • SQL Server Reporting Services 2008: How to set the credentials property properly?

    - by wgpubs
    No matter how I configure the Credentials property I get a 401 exception when I try to Render the report. Here is my (latest) code: var rs = new ReportExecutionService(); rs.Url = "https://myserver/reportserver/reportexecution2005.asmx"; var myCache = new System.Net.CredentialCache(); myCache.Add(new Uri(rs.Url), "kerberos" , new System.Net.NetworkCredential("username", "password", "Domain")); rs.Credentials = myCache; The URL and credentials are all correct. But still getting a 401 when I cal rs.Render(...). The Reporting Services install is sitting on a Windows Server 2008 box and requires integrated authentication. Thanks

    Read the article

  • Cannot edit ColumnDefinitions property in Visual Studio WPF application, ellipsis are invisible!

    - by SLC
    I have a window that looks like this: <Window x:Class="MyWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="My Title" Height="300" Width="300" ResizeMode="NoResize" SizeToContent="Height" WindowStartupLocation="CenterOwner"> <DockPanel> <Grid x:Name="MyGrid" DockPanel.Dock="Top" Margin="10"> </Grid> </DockPanel> </Window> Pretty simple. The instructions I am following suggest that if I click the item, the properties window will appear (it does), and then I can click ColumnDefinitions (which is a Collection) to bring up the Collection Editor and add some columns. However, the ColumnDefinitions property looks like this: The ColumnDefinitions ellipsis you'd normally press is gone, or invisible, or something. Any idea why?

    Read the article

  • How do I programmatically set property of control in aspx file ?

    - by Thomas Wanner
    This may be a very dumb question but I can't seem to get it working. I use at many places the following syntax for dynamically binding a property of a control in aspx file to the resource entry, e.g. <SomeFunnyControl Text="<%$ Resources : ResClass, ResEntry %>" /> I want to do a similar thing with a class containing some constants, something like <SomeFunnyControl Text="<%= MyConstantsClass.MyStringConstant %>" /> But this doesn't seem to work, it simply sets the text to the exact expression without evaluating it. I am using ASP.NET 3.5 btw. I have tried the databinding approach but I get an HttpParseException saying Databinding expressions are only supported on objects that have a DataBinding event.

    Read the article

  • How do I change a property's value based on a conditional in msbuild?

    - by Noel Kennedy
    I would like to change the value of a property if it is a certain value. In C# I would write: if(x=="NotAllowed") x="CorrectedValue; This is what I have so far, please don't laugh: <PropertyGroup> <BranchName>BranchNameNotSet</BranchName> </PropertyGroup> ///Other targets set BranchName <Target Name="CheckPropertiesHaveBeenSet"> <Error Condition="$(BranchName)==BranchNameNotSet" Text="Something has gone wrong.. branch name not entered"/> <When Condition="$(BranchName)==master"> <PropertyGroup> <BranchName>MasterBranch</BranchName> </PropertyGroup> </When> </Target>

    Read the article

  • Why was the arguments.callee.caller property deprecated in JavaScript?

    - by pcorcoran
    Why was the arguments.callee.caller property deprecated in JavaScript? It was added and then deprecated in JavaScript, but it was omitted altogether by ECMAScript. Some browser (Mozilla, IE) have always supported it and don't have any plans on the map to remove support. Others (Safari, Opera) have adopted support for it, but support on older browsers is unreliable. Is there a good reason to put this valuable functionality in limbo? (Or alternately, is there a better way to grab a handle on the calling function?)

    Read the article

  • How to implement a TypeConverter for a type and property I don't own?

    - by CannibalSmith
    This is annoying: <GeometryDrawing> <GeometryDrawing.Pen> <Pen Brush="Black"/> </GeometryDrawing.Pen> </GeometryDrawing> I want this: <GeometryDrawing Pen="Black"/> So I write a TypeConverter: public class PenConverter : TypeConverter { static readonly BrushConverter brushConverter = new BrushConverter(); public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { if (sourceType == typeof(string)) return true; return base.CanConvertFrom(context, sourceType); } public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { var s = value as string; if (a != null) { var brush = brushConverter.ConvertFromInvariantString(s) as Brush; return new Pen(brush, 1); } return base.ConvertFrom(context, culture, value); } } Now, how do I link it up with the Pen type? I can't just add a TypeConverterAttribute to it as I don't own it (nor do I own GeometryDrawing.Pen property).

    Read the article

  • Lambda expressions - set the value of one property in a collection of objects based on the value of

    - by Michael Rut
    I'm new to lambda expressions and looking to leverage the syntax to set the value of one property in a collection based on another value in a collection Typically I would do a loop: class item{ public string name {get;set;} public string value {get;set;} } class business { item item1 = new item(name="name1"); item item2 = new item(name="name2"); item item3 = new item(name="name3"); Collection<item> items = new Collection() {item1,item2,item3}; //This is what I want to simplify for( int i = 0; i < items.count; i++) { if(items[i].item.name == "name2") { //set the value items[i].item.value = "value2"; } } }

    Read the article

  • C# - Custom Attributes - Setting an attribute property to the type of the decorated class.

    - by cmaduro
    Is it possible to get the decorated class' type inside of the custom attribute's class? For example: [MetadataAttribute] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property, AllowMultiple = false)] public class ViewAttribute : ExportAttribute { public object TargetRegion { get; set; } public Type ViewModel { get; set; } public Type Module { get; set; } public ViewAttribute() : base(typeof(UserControl)) { Module = GetDecoratedClassType(); //I need this method } } In the following example GetDecoratedClassType() would return HomeView [View] HomeView MyHomeView { get; set; }

    Read the article

  • Saving a 'Date' using DataMapper on AppEngine+JRuby

    - by Ryan Montgomery
    I have a a model as follows: class Total include DataMapper::Resource property :id, Serial property :amount, Float, :default => 0.00 property :day, Date belongs_to :calendar end I am trying to select a specific Total from the data-store. class Calendar include DataMapper::Resource property :id, Serial property :name, String has n, :totals def get_total_for(date) return Total.first(:day => date, :calendar => self) end end When I call get_total_for(DateTime.now) I receive the following error on the call to the data-store. java.lang.IllegalArgumentException: day: org.jruby.RubyObject is not a supported property type. Is Date not allowed for usage in AppEngine? Is this a DataMapper issue? I have tried changing the name of the :day property to something else (hoping it was just a name conflict) but it doesn't seem to matter. Thanks for any help you can provide.

    Read the article

  • Want to add a new property to a class, can I use anonymous functions for this?

    - by Blankman
    I have 2 Lists: List<User> List<UserStats> So I want to add a property Count to User (it doesn't have one now, and I can't change the implementation at this point). For a web service call, that returns json, I want to modify the User object. Basically I add the Users to a collection. So I want to add a modified user class (via anonymous functions?) to the collection before I serialize it to json. So something like: loop users { user.Count = userstats[user.ID].Count; list.Add(user); } is this possible? how?

    Read the article

< Previous Page | 73 74 75 76 77 78 79 80 81 82 83 84  | Next Page >