How to pass a value from view model to model? - xamarin.forms

I'm programming a project about securities. Data object includes 5 properties: symbol, price, change, change percentage and quantity. But table of data only have 4 column, because the column "Change" include "change" and "change percentage" by clicking.
I set 2 bool var: IsVisibleChange and IsVisibleChangePct in object to decide alternate appering of "Change" and "ChangePct".
So I need how to pass a pass a value from viewmodel to model. Thank you!!

I'm not sure exactly what you need to do,but there's a way to pass values:
MessagingCenter
1.Publish a message by MessagingCenter.Send
2.Subscribe to a message by MessagingCenter.Subscribe

Related

adobe livecycle designer es2 percentages

I need to make some percentage fields, but I cannot make them like I need.
In total there will be 5 fields, with user input data format XXX%.
The first issue it that the fileds in total should sum 100% else an error message should appear.
The second issue, has to do with field format. The user should input 5 and the field should make it 005%.
Accordingly, user input 10 -> 010% and finally 100 -> 100%
Of course, the maximum input number should be the "100".
Any help?!?
Thank you in advance!
I assume the sum field total is calculated automatically using the calculate event, in that case you can use Javascript to display an error if all the field are filled and the total is not equal to 100.
For the dislpay, you need to use patterns, see documentation at : http://help.adobe.com/en_US/livecycle/9.0/designerHelp/index.htm?content=000490.html
For data validation, you can use validate event on the fields or manually check the value on the exit event of the field.

optional parameter addition to a colletion (asp.net C#)

Hello friends i am to add optional parameter to pass these in a method the parameter may vary every time.
And i need to pass these parameter to a method, so my question is how should i add these optional parameter to a collection and what kind of collection object should i use and how should i use that.
i elaborate here, i am having following fields.
1)course field(a drop down list) and on selected index change of course a check box list of corresponding branches are visible now i can select branches of choice by putting check mark on check boxes.(both course and branch are compulsory fields)
2)pass_out year which is a compulsory field.(a text field)
3)education gap which is optional so the text box may be empty as well and may having a digit as well.
4)required first year percent, second year, third year, final year, current degree, high school, senior secondary, gradation, post graduation, diploma percent, birth date which are all optional so these fields may also be empty or having a digit in the text box.
5) current backlog(a drop down list)having choices all, yes , no.
6)number of ATKT text box which may also be empty or can have a digit.
So i want to store all these variables value to some collection of object which will passed to a different method by passing all these variable from here,
But i am unable to figure out how should i store these optional variable to some object and how should i pass them to other method where all variable values will be taken out and an appropriate query will be written to interact with the data base to get the data table.
please elucidate me on this please. I am really not getting a feasible solution, i have thought of few options which i can let you know if you demand but those all seems to be tedious and difficult and redundant so i see help from you.
Don't bother with optional parameters or some collection of parameters, just decide how you will represent each value best, including how to represent empty values.
For a string value you can just use a null reference or an empty string. For a numeric value you can use a nullable int (int?). For a list of checkboxes where none is selected you can send an empty list.
When figuring out how to use this in a query to the database, it's easier if you have the values as parameters that always exist even if the values represent an empty value, rather than to have to parse out parameters from a collection where a parameter might be missing. Also, as you have different data types it's better if you can use an appropriate data type for each parameter, instead of casting everything into the same mold just to fit in a collection.

Dojo DataGrid - Getting data store item from formatter?

From what I've seen, the formatter function in Dojo DataGrid is given the following arguments: cell value, cell row number, and the cell object itself. Can you suggest how to obtain data store item to which this cell refers, given these arguments? Or if you can suggest an alternative way, I'd be grateful.
Found it. The grid has a method called getItem(), which accepts row number as argument.

Flex DataGridColumn with array of objects as data provider

I have a datagrid that uses an array of objects as the data provider. The objects are essentially key/value pairs:
{ foo:"something"}
{ bar:"hello"}
{ caca:"lorem"}
The datagrid has 2 columns. The first column is the key and the second column is the value. Right now my grid looks like:
My dataFormatter function makes sure that depending on the column (i.e. the dataField value) the correct key or value gets printed out. This works fine for displaying. However, as soon as I try and edit the value field it essentially adds a new value into the object with a key of '1'. For example, if I edit the {caca:"lorem"} object it will then contain the value {caca:"lorem",1:"new value"}.
Is there any possible way I can set the DataGridColumn so that when I edit a value it will update the value associated with the key rather than inserting a new value? I've tried using a custom item editor but it still does the insert. It seems like I need to be able to update the 'dataField' with the actual key value but I'm not sure how to do that.
Looks like you need to think about where your data is going to be stored. I would recommend listening for a CollectionEvent.COLLECTION_CHANGE event on your data model. That event object will contain info about what change occurred, and you can make any updates you need to make.

ASP.NET MVC Model Binding

I was wondering if there was a way to bind the value of an input field straight to the property in the Model through a strongly typed model. For example, let's say my Model is an Address object. I want to be able to say Html.Textbox(Model.Address1.State, "state", Model.Address1.State). So the first parameter would be the explicit property I want to bind to of the model with the value from the user, the second parameter would just be the DOM id, and the third value would be the initial value to input when I render the view.
I know you can do Html.TextBox("Address.State") and have a custom binder which would create the Address object for you and populate the state property. I need Html.Textbox(Model.Address1.State).
Help?
I think the FluentHtml stuff from the mvccontrib code is what you may want to check out.

Resources