Skip to content

Replies

0
Venkat
Venkat answered on Mar 24, 2017 3:18 AM

Thank you for all your help. It worked, i am able to resolve the below 2 issues.

1. Binding combo list control from Grid source, using unbind. On change event handling.

2. Binding Date field with format along with other columns in the Template.

Thank you very much for all the help. Have a wonderful vacation(time off)

I will go through the detailed documentation once again to utilize it more.

0
Venkat
Venkat answered on Mar 23, 2017 12:22 AM
Thank you Michael for the reply. When i included below code in the sample which you sent earlier, added Date column to the grid. It is throwing error for ItemTypes. 
Added StartDate DateTime variable to Item class and assigned random values.

View code:

column.For(x => x.StartDate).Format("dateTime").Template("<a href='#' onclick=''>${ItemName}</a><br />${StartDate}").HeaderText("Name<br />Date").Width("100px");
column.Unbound("types").HeaderText("Category").Width("200px")
.Template("<select>{{each ${ItemTypes} }} <option value='${ItemTypes.ItemValue}'>${ItemTypes.ItemText}</option> {{/each}}</select>");

If i use one column at a time, both works fine. When i include both the fields, throws error and Grid is not bind to UI.

Error message: JavaScript runtime error: An error has occurred while trying to retrieve data source property: ${ItemTypes}

Sorry to bother you, another question – assume another property in the Item class "ReferenceID" of type INT, how to read it in the combo change event ${ReferenceID} is need to be passed to change event

Thank you in advance.

0
Venkat
Venkat answered on Mar 21, 2017 8:56 PM

Michael,

When i used as below, im able to see the Combo list, but Date is not showing as expected. 

column.Unbound("RegisterDate").Template("<a href='#' onclick='GoToStudent(${StudentID})'>${Name}</a><br />${RegisterDate}").HeaderText("Name<br />Date");

On the UI, date is showing as "/Date(1488690542583)/". I need to show like 03/20/2017 12:25:02 AM.

0
Venkat
Venkat answered on Mar 21, 2017 8:30 PM

Thank you Michael for the help. It worked for the Combo List. But some binding issue to the Combo, if we have a Date field in the Grid's source. Without Date column on the Grid, it is working fine. Below is my View looks like

column.For(x => x.RegisterDate).Template("<a href='#' onclick='GoToStudent(${StudentID})'>${Name}</a><br />${RegisterDate}").HeaderText("Name<br />Date");

column.Unbound("Subjects").HeaderText("Subject Names").Template("<select>{{each ${SubjList} }} <option value='${SubjList.Value}'>${SubjList.Text}</option> {{/each}}</select>");

If included RegisterDate column, then combo items are showing as undefined. If it is removed then showing the Subjects combo list. What is the solution to resolve it?

2. Is it possible to show each Combo list item as a Link?

Thanks in advance 

0
Venkat
Venkat answered on Mar 16, 2017 4:15 PM

Thank you for the response Michael. 

In your example, you are reading the Categories from the ViewBag, which is static list same across all the rows in the Grid. But i have it as property in the Grid datasource. Categories are different for each row. I can not use the static list from ViewBag, it is different list for each product.

My modal looks like

class Product { public int ProductID; public string ProductName; public List<SelectListItem> Categories;  }

Source of the grid is: List<Product> ProductList

How can we read the Categories from each Product in the ProductList and bind it to the combo in the Categories column?

Thank you in advance.

0
Venkat
Venkat answered on Mar 15, 2017 5:23 PM

I have the script ready for how to generate the tab, so i need help to populate the drop downlist with links as items and click on them pass the dropdown selected value.