List View Item Deleting parameters not passed to Object Data source - asp.net-4.0

I have a ListView bound to an ObjectDataSource, I'm passing some custom parameters to the Insert and Update methods on my bound class methods by adding them to the event.Values map in the ListView ItemInserting/ItemUpdating events.
However when I try to do the same thing on the ItemDeletingEvent the additional parameters do not seem to be passed to the datasource ( If I register a listener for ObjectDataSource.ItemSourceDeleting I only see one parameter, effectively the 'id' of the row).
Is this an expected behavior? I can't see anything in the documentation that indicates as such.

I found a solution -
I Added a 'DeleteParameter' value with the same name as my desired 'custom' parameter to the ObjectDataSource declaration.
Then in the ItemDeleting Event get the ObjectDataSource.DeleteParameters["myparam"] and set the DefaultValue property. Seems like a hack, but it does work.

Related

V-Model not cleansed when adding Object to array (Vue-Js)

I'm trying to add objects (simple key-value pairs) to a list.
However, the v-model is still bound to the previously added objects, so if I add "ObjectOne" vith "ValueOne", then try to add "ObjectTwo" with "ValueTwo", "ObjectOne" gets edited AND "ObjectTwo" gets added.
I am by no mean an expert in Javascript, so it might not be related to VueJS.
I can obviously make this work with a method per list .
The point is that my model has multiple lists of key value pair to be edited, so I tried making a generic method :
addToList: function(value, list){
console.log("Adding " + value + " to list "+list);
list.push(value);
value={};
},
This method works if used on "simple" lists (like an array of string), but not on "objects" list.
My guess is that as I try to clean "value" instead of "this.value", the reference still points to the same object, but since I don't know what "value" will be when called, I don't know how to do this.
Here is the fiddle with a re-creation of my issue.
My objective would be to be able to use the "addToList" function to add to any list, without having to re-write a function for each list.
Thank you for your help.
The above behaviour is because you are updating the value of same object whenever you add a new todo task.You need to set your object again to add new values as below.
addToList(value, todos){
this.todos.push(value);
this.anotherTodo={ text:'',
done:'false'}
}
Working fiddle here.
I post this as an answer, but if someone has a better way to do it, I'm all hear.
I solved the way by adding a watch on my list. When the list changes, I clean the model object that's added to it.
In my production work, I had to add a computed property, since I can't add a watch on an object's property, then a watch on said computed property :
watch:{
todos(){
this.anotherTodo={};
},
fiddle as demo

What are directives? dojo dstore

What is the second parameter {directives} for methods put and add?
Does anyone know what you can put here?
https://github.com/SitePen/dstore/blob/master/docs/Store.md
put(object, [directives]) This stores an object. It can be used to update or create an object. This returns a promise that may resolve to the object after it has been saved.
add(object, [directives]) This creates an object, and throws an error if the object already exists. This should return a promise for the newly created object.
As GibboK mentioned Directives are object containing information about creating and updating stored objects.
The valid properties are:
id - String|Number? - id is used to as identity for new object. Used in add() only.
beforeId - String? - the new created or update object to be place before the id mentined in the property.
overwrite - Boolean? - indicates that the object should or should not overwrite an existing object.
The documentation can be found in the code "dstore\Store.js" Store.PutDirective. There is also another property parent which is not used.
The directive for dstore\Rest has additional property header - Object? which would contain the header information for the request.
You may have to look at the type of store, you are using to get the complete documentation of the valid object you can pass as [directives].
Hope this was helpful.
Directives passed to put() and add() handlers for guiding the update
and creation of stored objects.
Unfortunately, there is very limited documentation about directives.

Create a property dynamically

I have an Structure in a Class where i have a property named 'Name'. and other properties values inside the structure depends of the set of this value, is there any way to make them publics only when this first property is Set ?.
When i create an instance of the class , and access to this structure all the properties are available.
I would hook up these properties with an ICommand implementation.
For each property that depends on Name, they can use CanExecute to determine if Name is set. If so, CanExecute will return true, and the Command will be executed for the property (which can hook up to a method to do anything you want...get a value, set a value, etc.)
More information here

Binding an NSPopUpButton

OK, so here's my situation :
I've got an NSDictionary, let's call it : myItem.
myItem.valueNames contains the values that I want to show up in the popup
myItem.values contains the values the popup must return (e.g. for valueName[0] -> value[0], and so on)
myItem.value contains the current value
How am I suppose to bind that? Even though I've studied the official reference, it still looks a bit obscure...
I'm currently binding :
myItem.valueNames to Content
myItem.values to Content Objects
myItem.value to Selected Value
and... all I've managed is that it shows the valueNames.
Any ideas?
Your model is a little strange to me. I wouldn't use an NSDictionary, I'd use a custom subclass with KVC/KVO compliant properties for each of these. Also, if the name of each value is a property of the value object itself, there's no need for a separate valueNames property. So, with that change, I'd do this:
Bind Content to modelObject with a key path of values
Bind Content Values to modelObject with a key path of values.name
Bind Selected Object to modelObject (or yourControllerObject if that makes more sense) with a key path of value (I'd name it selectedValue)

Reusing property editors for Blend 4

I have a custom silverlight control, which exposes a property with DataGridLength type. Now I want that property to have the same editor as a common DataGridColumn's Width property, with the combobox and everything, like this:
instead, I only get a simple TextBox, with "Auto" written in, with no way to set to SizeToCells and so on.
I assume I need a DesignTime attribute, but none of the ones I found in ComponentModel namespace even came close...
I guess you just have to create an Enum with the all the values autorized (Pixels, SizeToCells, etc ...), you that Enum as the type of your property DataGridLength and then, in the code of your control, take the corresponding action regarding the value sent.