creating a checkbox in a grid - asp.net-mvc

I have to create a grid in mvc which will have the following columns
select -- checkbox,
Invoice date,
Invoice Number,
Acct Number,
Amount,
Amount due
Users will be able to click on a checkbox under select column for a line of record. I am new to Mvc. How do I write a viewmodel for this? Do I include the first column "select" in the viewmodel? How will I also represent this in my html?

Information about webgrid
Your ViewModel is just a normal model:
Boolean, DateTime, int, int, int, DateTime (I guess). And your select is just plain text; it is not going to vary from record to record.

Related

Google sheet create dropdown from some values in column

I am working with google sheet. I have two sheets named App Catgeory and Directory Category.
App category have two column:-
1. Category Name
2. Is Selectable
In Directory Category i have category selection dropdown which is created from Category Name column of App category sheet.All the values in Category Name column are available in dropdown.
Dropdown is created by this data validation formula:-
='App-Category'!$C$2:$C
But, I want such Category Name in dropdown which have Is Selectable column value Yes in App category.If Is Selectable column value is No then such category Names are not need to displayed in dropdown.
So, how can i achieve this.
Thanks in advance!!
I believe you cannot directly achieve what you are expecting. instead you can have a derived column using a query to get the dropdown values and then use it to populate the drop down.
= QUERY('App Catgeory'!A2:B21,"select A where (B = 'yes')")

Sort Range Ignoring "" Flavor of Blank on Google Sheets

I have a spreadsheet with 2 main columns.
Column A is the student's name.
Column B is the student's grade.
Other columns (not shown) list various information about the student that the end users input.
End users click on the Data Validation Arrow to select the student in Column A, and the student's grade is auto populated in Column B.
The formula in Column B is:
=IF(A2="","",Index(All!$B:$B,Match(A2,All!$A:$A,0)))
The All sheet contains a master directory of the Students and their Grade level assignment.
The Problem:
When users attempt to re-sort the data using the Sort A-Z menu option in B1, it includes the blank cells in the sort - The blank cells come first, moving all the relevant data to the bottom of the sheet.
I understand that G-Sheets considers "" to be text. Is there another method to write my formula that would keep the Grade column blank, but allow for the sorting feature to function as end users would expect?
You can implement two additional comments where you filter the results before sorting them:
=SORT(FILTER(A2:B,not(B2:B="")),2, true)

Indexing with a Date field (as a String) in ClientDataSet

on Delphi XE2,
I have a ClientDataSet which have many fields as Name, ...
It have a field named Date, as value type String. Containing a Date (dd/mm/yyyy)
I want to print content of ClientDataSet, using FastReport.
I want before to sort content ascending according to the Date field. I'm using index.
But when doing this, sorting does only sorts fields according to the content of the Date string before the "/".
form example dates like : 12/11/2012, 15/10/2012, 01/12/2012 are sorting like this : 01/12/2012 - 12/11/2012 - 15/10/2012.
ny idea how doing this correctly ?!
The sorting is correct! As you have a string field, the sorting is made like strings are sorted i.e. from left to right. If you want it sorted by Date you need either a date field or sort the string representation like yyyy/mm/dd.
You have some options:
Bring the field as a DateTime field. You would have to change the original SQL to that.
Do what Marjan suggested, bringing that string field formatted on an ISO-like style (which allows for the field to be ordered cronologically when string sorting is aplied) and creating an calculated field for user-display formatting.
Creating a new field on the TDatasetProvider's OnGetRecords event and populating it as a Date field.
Similar as above but creating a string field with the date formatted in ISO-Like style.
I personally suggest the first approach if possible.

Reordering ADO Recordset columns

I have a recordset with columns
e.j
ID_PEOPLE
NAME
AGE
And I need to reorder this columns to
ID_PEOPLE
AGE
NAME
This recordset is used to fill an Excel spreadsheet and need to change the recordset column order because reordering in Excel is to slow.
Any idea?
Right click on your Table/Query, select Field Editor.
If there are not fields, press CTRL+F.
Drag by mouse fields changing order as you want.
Or, if you have a Query, you may change select field order: select Field2, Field1 from Table.
Or you may physicaly redesign field order in your table/view/procedure.

RadGrid MVC Column Formationg

I am using the following line of code to format the data in my RadGrid column:
columns.Bound(p => p.Price).Format("${0:0.00}");
It works fine when the item has a price but throws a NullReferenceException when the price field is null.
If you have your model defined to accept null for the Price field, there is nothing in the RadGrid that should throw a NullReferenceException. Just to make sure I build a dummy grid that has a bound column that matches the code in your question. In my model, I set the value of the price field to null for one of the items. The result was just an empty cell for that item.

Resources