Here I load array from data table to array list
- public static ArrayList LoadView()
- {
- DataTable dt = new DataTable();
- DataView view = new DataView(dt);
- view.RowFilter = (("Name='AD'"));
- DataTable dtcopy = view.ToTable("Selected", false, "Row1", "Row2");
- var arr = dtcopy.Rows.Cast<DataRow>().Select(r => r.ItemArray).ToArray();
- ItemList.Add(arr1);
- DataView view2 = new DataView(dt);
- view2.RowFilter = (("Name='ProE'"));
- DataTable dtcopy2 = view2.ToTable("Selected", false, "Row1", "Row2");
- // remove some column from datatable
- var arr2 = dtcopy2.Rows.Cast<DataRow>().Select(r => r.ItemArray).ToArray();//Convert datatable to array
- //return arr2;
- ItemList.Add(arr2);
- return Itemlist;
- }
- Javascript:
- PageMethods.LoadView();
- function LoadSucc(obj,obj1)//Retur arraylist
- {
- var goog = [];
- goog = obj;
- var goog1 = [];
- goog1 = obj1;
- }
1 Reply
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Chetan RanpariyaPosted Jan 5, 2017, 1:40 AM