0
A
回答
0
DataGrid dgDetails = new DataGrid();
dgDetails.DataSource=dt (some data from your DB)
dgDetails.DataBind();
2
試試這個..
DataGridView dgv = new DataGridView();
/// if your want to fill DataGridView from Database then pass your required datasource to DataGridView, like below..
// dgv.DataSource = dt(Some data Source);
// if you want to add column in Code, then follow below Code..
dgv.Columns.Add("Column", "Name");
dgv.Columns.Add("Column", "Address");
dgv.Rows.Add("abc","xyz");
this.Controls.Add(dgv);
相關問題
- 1. 在運行時生成代碼
- 2. 如何運行wxGlade生成的代碼
- 3. 如何在運行時在.net winforms中生成代碼事件?
- 4. 運行時Orm代碼生成器
- 5. 運行時代碼生成和編譯
- 6. 如何在程序運行時生成並編譯C++代碼?
- 7. 是否有可能在運行時生成並運行TemplateHaskell生成的代碼?
- 8. 如何在運行時通過代碼創建datagrid?
- 9. 如何編寫運行AFTER DataGrid完成渲染的代碼?
- 10. xtext代碼生成,如何避免代碼生成一行?
- 11. 運行「rails生成腳手架」時會運行什麼代碼?
- 12. Java代碼在運行時生成和執行,java.lang.NoClassDefFoundError
- 13. 如何在運行時從JTextArea運行/編譯Java代碼?
- 14. 如何在運行時在代碼中獲取NHibernate生成的SQL?
- 15. 代碼分析在biztalk 2009生成的代碼上運行
- 16. 如何在未找到任何代碼時生成代碼
- 17. 生成VB.NET代碼來運行SSIS包?
- 18. 運行由soapui生成的axis2代碼
- 19. Android - 在排球響應生成時運行一段代碼
- 20. 在C#中生成運行時代碼(結構體,類)#
- 21. 在運行時生成,編譯和使用Java代碼?
- 22. 在Linux shell腳本中生成運行時代碼
- 23. 在運行時生成機器指令的Hello世界代碼?
- 24. 在運行時生成代碼中的c#項目
- 25. WPF Datagrid DataGridComboBoxColumn在運行時自動生成
- 26. 在運行時從wsdl生成JAVA類
- 27. 如何在運行時爲Sharepoint生成代理類
- 28. 如何讓XCode 4在保存更改時自動生成並運行代碼?
- 29. 如何做出來的過時我在運行之前代碼自動生成?
- 30. 何時在運行時生成圖標?
IS是ASP或WPF的DataGrid? – Gun
c#windows窗體datagrid。 –
@ErangaLakmalPerera ..查看下面的答案.. –