How to Merge Columns in DataGrid
- 1). Click the Windows "Start" button and select "Programs." Click "Microsoft .NET Framework," then click "Visual Studio." Click your project name in the splash screen to open your coding files.
- 2). Double-click the form that contains your DataGrid. When the form opens, double-click the DataGrid to point your cursor to the DataGrid section of your code file.
- 3). Type the following code to merge your files:
e.Item.Cells(0).ColumnSpan = 2
e.Item.Cells(0).Text = "<table ><td colspan=2>Name</td></tr><tr align =center ><td>First Name</td><td>Last Name</td></tr></table>" - 4). Click "Run" at the top of your Visual Studio window. The "Run" button lets you see the DataGrid code changes in your web browser.