Pretty new to infragistics. i am using asp.net web forms
i have a wdg that is editable. For one of the columns, i would like to have a dropdown list.
i have tried both templates and providers, with limited success. Which is best for my application ?
the column in the grid is supervisor_emp_id
the dropdown is populated with emp_id and name
thanks
Hello Peter,
I’m glad I was able to help.
In case you need to look up at any of our client-side objects, methods, properties etc. here is a list with all the libraries of our ASP.NET AJAX CSOM:
https://es.infragistics.com/help/aspnet/aspnet-ajax-csom
Regards, Ivan Kitanov
Awesome. Thanks for your help.
It will take some time to learn all the javascript functions. One thing i learned so far is that
using editorproviders is better because you can retrieve values very easily. Using templates,
you need to trap value changed and save it somewhere for retrieval
It is not necessary to use Sessions variables, the reason why most of the samples use them is for simplicity.
Below you can find a page in our documentation regarding the EnableDataViewState and how it affects the functionalities:
https://es.infragistics.com/help/aspnet/webdatagrid-getting-started-with-webdatagrid-enabledataviewstate-property
In addition to this, in the following page there is an Infragistics article about DataViewState vs ViewState, while using the WebDataGrid, on the left side there is a section with many other articles related to the WebDataGrid.
There is also a general article that goes in depth about the ViewState, which you can find here:
https://weblogs.asp.net/infinitiesloop/Truly-Understanding-Viewstate
Thanks. Good info. I think i will use a ajax call to retrieve value rather
than have all table data in json string
It seems wasteful to save data in session vars ? that is a lot of strain
on the web server. I notice other samples do this too. Is this necessary ?
I do notice odd behavior when playing with viewstate. Unable to go into
edit mode after saving. Nothing in dropdowns
Are there any good articles on this ?
Thanks for your help
I have created a sample that follows your approach that uses a TemplatedField with WebDropDown, which uses tables to display multiple columns. In order to access the data source of the WebDropDown and set the value of a field based on the selection that the user has made, I recommend you serializing the data to a JSON string and then extracting the needed data based on the index of the selected item. The serializing could be done with the help of the following method:
public string ConvertDataTabletoString() { DataTable dt = (DataTable)Session["DS"]; System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer(); List<Dictionary<string, object>> rows = new List<Dictionary<string, object>>(); Dictionary<string, object> row; foreach (DataRow dr in dt.Rows) { row = new Dictionary<string, object>(); foreach (DataColumn col in dt.Columns) { row.Add(col.ColumnName, dr[col]); } rows.Add(row); } return serializer.Serialize(rows);
I was able to reproduce the behavior, where the grid doesn’t enter edit mode on the TemplatedField, I would need some more time to investigate what might be causing this. If you would like to move enter edit mode to another field the following line could be used:
grid.get_behaviors().get_editingCore().get_behaviors().get_cellEditing().enterEditMode(cell);
You can find the sample attached below. Please test it on your side and let me know if you have any questions.
TemplateFieldMultiColumnDropDown.zip