2013-04-30 67 views
0

之前,我有這樣的代碼:爲了柱結合電網

ProductRanges_Grd.DataSource = 
    ProductRangesDt.DefaultView.ToTable(true, "PROVIDER_ID", "PROVIDER_NAME"); 

我可以爲了通過PROVIDER_NAME結合我網之前,我怎麼能做到這一點任何幫助

回答

4
// Create DataView 
DataView view = myDataTable.defaultview; 
// Sort by PROVIDER_ID and PROVIDER_NAME column in descending order 
view.Sort = "PROVIDER_ID ASC, PROVIDER_NAME ASC"; 
ProductRanges_Grd.DataSource = view.ToTable(); 
+1

+1 ,更好的選擇。我需要在LINQ之外思考:P – Habib 2013-04-30 07:18:44

+0

謝謝你的好回覆 – Sora 2013-04-30 08:07:27

0
myDataTable.DefaultView.Sort = "PROVIDER_NAME ASC"; 
    ProductRanges_Grd.DataSource = myDataTable; 
    ProductRanges_Grd.DataBind();