Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4106898
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T21:26:08+00:00 2026-05-20T21:26:08+00:00

I have a gridview with predefined columns and a selectcommand. Why do I get

  • 0

I have a gridview with predefined columns and a selectcommand. Why do I get the columns twice? I want to keep the predefined columns and the selectcommand, but avoid getting the columns double.

<asp:GridView ID="gvMeldingen" runat="server" 
            AllowSorting="True" DataSourceID="MyDataSource" 
            onselectedindexchanged="GridView_SelectedIndexChanged"
            AutoGenerateSelectButton="True">
            <Columns>
                <asp:BoundField DataField="Melder" HeaderText="Melder" />
                <asp:BoundField DataField="Onderwerp" HeaderText="Onderwerp" />
                <asp:TemplateField HeaderText="Omschrijving">
                    <ItemTemplate>
                        <div style="overflow:auto; width: 500px; height: 150px;">
                            <asp:Label ID="lblOmschrijving" runat="server" Text='<%# Bind("Omschrijving")%>'></asp:Label>
                        </div>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="Fasedatum" HeaderText="Fasedatum" />
                <asp:BoundField DataField="Niveau 1" HeaderText="Niveau 1" />
                <asp:BoundField DataField="Niveau 2" HeaderText="Niveau 2" />
                <asp:BoundField DataField="Outlook_ID" HeaderText="OutlookID" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="MyDataSource" runat="server" 
            ConnectionString="<%$ ConnectionStrings:HELPDESK_OUTLOOKConnectionString3 %>" />

This code shows how I use the selectcommand:

protected void MenuTabs1_MenuItemClick(object sender, MenuEventArgs e)
    {
        string select = @"SELECT 
        aanvrager.werknemersnaam AS Melder,
        hd_aanvragen.aanvraag_titel AS Onderwerp, 
        hd_aanvragen.aanvraag_omschrijving AS Omschrijving, 
        hd_aanvraag_fase.fase_datum AS Fasedatum, 
        hd_melding_niveau_1.niveau_omschrijving AS 'Niveau 1', 
        hd_melding_niveau_2.niveau_omschrijving AS 'Niveau 2',
        hd_aanvragen.outlook_id
        FROM hd_aanvragen
        INNER JOIN hd_meldingen         ON hd_meldingen.melding_id      =  hd_aanvragen.melding_id 
        INNER JOIN hd_melding_niveau_1  ON  hd_melding_niveau_1.niveau1_id = hd_meldingen.niveau1_id 
        INNER JOIN hd_melding_niveau_2  ON  hd_melding_niveau_2.niveau2_id = hd_meldingen.niveau2_id 
        INNER JOIN hd_aanvraag_fase     ON hd_aanvraag_fase.aanvraag_id =  hd_aanvragen.aanvraag_id
        INNER JOIN hd_statussen ON hd_statussen.status_id =  hd_aanvraag_fase.status_id 
        INNER JOIN  hd_werknemers AS oplosser ON oplosser.werknemer_Id =  hd_aanvraag_fase.werknemer_Id 
        INNER JOIN hd_werknemers  AS aanvrager ON aanvrager.werknemer_Id =  hd_aanvragen.werknemer_Id 
        WHERE hd_statussen.status_id = ";

        int index = Int32.Parse(e.Item.Value);
        multiTabs1.ActiveViewIndex = index;
        int status = 0;
        if (index == 1)
            status = 2;
        else if (index == 2)
            status = 16;
        else if (index == 3)
            status = 17;
        else if (index == 4)
            status = 4;
        MyDataSource.SelectCommand = select + status;
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T21:26:09+00:00Added an answer on May 20, 2026 at 9:26 pm

    You have to add the AutoGenerateColumns property to your GridView with value “false”.
    That will let the GridView know that no columns should be automatically generated during the bind process.

    Good luck! 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have GridView: <asp:GridView ID=MyGridView runat=server ShowFooter=true AutoGenerateColumns=False Visible=True> <Columns> <asp:BoundField DataField=id ItemStyle-HorizontalAlign=center/> <asp:BoundField
I have GridView(id: gv_test) with two columns: itemId ImageButton (id: ImageBTN) <asp:ImageButton ID="ImageBTN" Width="34px"
Have a gridview control which will show X amount of rows. I want to
I have a gridview and I have a button on it.I want, if the
I have a gridview and and I am creating it dynamically, I get parent
I have a GridView and I want to export it in Word document using
I have gridview in my asp.net 3.5 application [C#]. Which looks like this: <asp:GridView
i have a gridview i am working on VS2008 ASP.Net forms Currently, my update
i have a gridview and inside i have a TimeSelector, but how am i
I have a Winform DataGridView , which has a number of predefined columns. Now

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.