GridView display columns twice

Hello, I want to display a table and implement an insert new row function. The table has 5 columns. But something is wrong.
Please look at my code and image. table
    <asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1" EnableModelValidation="True">
        <Columns>
            <asp:CommandField ShowSelectButton="True" />
            <asp:TemplateField HeaderText="Orgnization Code" SortExpression="OrgCode">
                <ItemTemplate>
                    <%# Eval("OrgCode") %>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Eval("OrgCode") %>'></asp:TextBox>
                </EditItemTemplate>
                <FooterTemplate>
                    <asp:Label ID="Label6" runat="server" Text="Code"></asp:Label>
                    <asp:TextBox ID="InsertOrgCode" runat="server" Text='<%# Bind("OrgCode") %>'> </asp:TextBox>
                </FooterTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Orgnization Name" SortExpression="OrgName">
                <ItemTemplate>
                    <%# Eval("OrgName") %>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Eval("OrgName") %>'></asp:TextBox>
                </EditItemTemplate>
                <FooterTemplate>
                    <asp:Label ID="Label7" runat="server" Text="Name"></asp:Label>
                    <asp:TextBox ID="InsertOrgName" runat="server"></asp:TextBox>
                </FooterTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="OrgContactName" SortExpression="OrgContactName">
                <ItemTemplate>
                    <%# Eval("OrgContactName")%>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox3" runat="server" Text='<%# Eval("OrgContactName") %>'></asp:TextBox>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="OrgContactPhone" SortExpression="OrgContactPhone">
                <ItemTemplate>
                    <%# Eval("OrgContactPhone")%>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox4" runat="server" Text='<%# Eval("OrgContactPhone") %>'></asp:TextBox>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="OrgContactEmail" SortExpression="OrgContactEmail">
                <ItemTemplate>
                    <%# Eval("OrgContactEmail")%>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox5" runat="server" Text='<%# Eval("OrgContactEmail") %>'></asp:TextBox>
                </EditItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>

Open in new window


Thanks for help.
zhshqzycAsked:
Who is Participating?
 
Cenjoy100Commented:
Try this
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"DataSourceID="SqlDataSource1" EnableModelValidation="True">
        <Columns>
            <asp:CommandField ShowSelectButton="True" />
            <asp:TemplateField HeaderText="Orgnization Code" SortExpression="OrgCode">
                <ItemTemplate>
                    <%# Eval("OrgCode") %>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Eval("OrgCode") %>'></asp:TextBox>
                </EditItemTemplate>
                <FooterTemplate>
                    <asp:Label ID="Label6" runat="server" Text="Code"></asp:Label>
                    <asp:TextBox ID="InsertOrgCode" runat="server" Text='<%# Bind("OrgCode") %>'> </asp:TextBox>
                </FooterTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Orgnization Name" SortExpression="OrgName">
                <ItemTemplate>
                    <%# Eval("OrgName") %>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Eval("OrgName") %>'></asp:TextBox>
                </EditItemTemplate>
                <FooterTemplate>
                    <asp:Label ID="Label7" runat="server" Text="Name"></asp:Label>
                    <asp:TextBox ID="InsertOrgName" runat="server"></asp:TextBox>
                </FooterTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="OrgContactName" SortExpression="OrgContactName">
                <ItemTemplate>
                    <%# Eval("OrgContactName")%>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox3" runat="server" Text='<%# Eval("OrgContactName") %>'></asp:TextBox>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="OrgContactPhone" SortExpression="OrgContactPhone">
                <ItemTemplate>
                    <%# Eval("OrgContactPhone")%>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox4" runat="server" Text='<%# Eval("OrgContactPhone") %>'></asp:TextBox>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="OrgContactEmail" SortExpression="OrgContactEmail">
                <ItemTemplate>
                    <%# Eval("OrgContactEmail")%>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox5" runat="server" Text='<%# Eval("OrgContactEmail") %>'></asp:TextBox>
                </EditItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>

Open in new window

0
 
Cenjoy100Commented:
keep AutoGenerateColumns="False"
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.