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 8526249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:13:08+00:00 2026-06-11T08:13:08+00:00

I have a GridView inside a UpdatePanel . In some cases, I have to

  • 0

I have a GridView inside a UpdatePanel. In some cases, I have to show different columns in this GridView so I need to change the BoundFields that are specified in my aspx.

How can I change the BoundFields to make the GridView be filled for a different query and different fields ?

ASPX

<cc1:GridView ID="grdImoveis" CssClass="StyleGrid" Width="100%" runat="server" ShowHeader="false"
            AutoGenerateColumns="False" DataSourceID="dsGrid" BorderWidth="0px" GridLines="None"
            AllowPaging="True" EnableModelValidation="True" >
            <AlternatingRowStyle BackColor="White" CssClass="EstiloDalinhaAlternativaGrid" HorizontalAlign="Center" />
            <RowStyle CssClass="EstiloDalinhaGrid" HorizontalAlign="Center" />
            <Columns>
                <asp:BoundField HeaderText="Nome" DataField="NomeCompleto" />
                <asp:BoundField HeaderText="Cargo" DataField="DescricaoCargo1" />
                <asp:BoundField HeaderText="Data Cadastro" DataField="DataHora" />
                <asp:TemplateField ControlStyle-CssClass="acoes_lista_imovel" HeaderText="Curso">
                    <ItemTemplate>
                        <div class="acoes_lista_imovel">
                            <%# montaIcones(Eval("Usuario_Id").ToString())%>
                        </div>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </cc1:GridView>

CODE BEHIND

protected void btnSelecionarData_OnClick(object sender, EventArgs e)
    {            
        string select = string.Empty;
        select += "SELECT San_Credenciada.Apelido, San_Usuario.NomeCompleto, San_Usuario.Usuario_Id, San_Usuario.DescricaoCargo1, "
            + "CONVERT(varchar, San_Usuario.DataHora, 103) AS DataHora, San_UsuarioCurso.Cv, San_UsuarioCurso.Institucional, "
            + "San_UsuarioCurso.Copon, San_UsuarioCurso.ManualCaptacaoESistema, San_UsuarioCurso.PosturaProfissional, San_UsuarioCurso.Certificado "
            + "FROM San_Usuario "
            + "JOIN San_Credenciada "
            + "ON San_Usuario.Credenciada_Id = San_Credenciada.Credenciada_Id "
            + "JOIN San_UsuarioCurso "
            + "ON San_Usuario.Usuario_Id = San_UsuarioCurso.Usuario_Id "
            + "WHERE San_Usuario.Provisorio = 1 "
            + "AND San_Usuario.Excluido = 0 "
            + "AND San_UsuarioCurso.DataCurso = '" + this.DtBusca.Value.ToString() +"' "
            + "GROUP BY San_Credenciada.Apelido, San_Usuario.NomeCompleto, San_Usuario.Usuario_Id, "
            + "San_Usuario.DescricaoCargo1, San_Usuario.DataHora, San_UsuarioCurso.Cv, San_UsuarioCurso.Institucional, "
            + "San_UsuarioCurso.Copon, San_UsuarioCurso.ManualCaptacaoESistema, San_UsuarioCurso.PosturaProfissional, San_UsuarioCurso.Certificado "
            + "ORDER BY San_Usuario.DataHora ASC ";

        dsGrid.ConnectionString = c.Con;
        dsGrid.SelectCommand = select;
        dsGrid.Dispose();
  • 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-06-11T08:13:09+00:00Added an answer on June 11, 2026 at 8:13 am

    If I understand your query correctly, you want to change columns. A simple solution for this is that do not specify fields in your aspx page, just set AutoGenrateColumns = True in your grid view decleratoin
    Your grid should look like

    <asp:GridView ID="gv" runat="server" AutoGenrateColumns="True" />
    
    // Now in your code behind just specify its DataSource property it will fill up with your desired columns.
    // Your query should contain only those columns which you want to show 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Need some help to solve this. I have a gridview and inside the gridview
I have a simple situation that does not work. Gridview is nested inside updatepanel
I have a gridview inside an updatepanel and I have a javascript that calls
I have a GridView inside an UpdatePanel that is populated when a search is
I have a GridView inside an UpdatePanel and because of some bug I can't
I have a GridView that is inside of an UpdatePanel. I am using the
I have Tab Container, and i have a GridView inside that. I need to
I have the following gridview that is inside an updatepanel: <asp:UpdatePanel ID=UpdatePanel1 runat=server> <ContentTemplate>
I have a gridview inside an updatepanel. It has a TemplateField column with radiobutton:
I've got an asp.net gridview inside an updatepanel. One of the fields I have

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.