husham1414
husham1414

Reputation: 61

C# datagrid duplicate the columns when I try to get the data from database table

the code to get the database and show it on the datagrid in this image image My Code

datagrid wpf design image My DataGrid WPF

the result image Result

as shown in the image it duplicate the columns ,one with renamed headers and the other one with same headers from database table

I just want those with renamed headers without duplicate ?

Upvotes: 0

Views: 176

Answers (2)

Waqas Amjad
Waqas Amjad

Reputation: 305

Use AutoGenerateColumns = "false".

<asp:GridView ID="GridView1" runat="server" DataSourceID = "SqlDataSource1" AutoGenerateColumns = "false">

Upvotes: 1

Matt
Matt

Reputation: 71

Set AutoGenerateColumns to false. You have prepared your columns in xaml so you do not want to code generate them for you

Upvotes: 3

Related Questions