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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:47:23+00:00 2026-05-29T07:47:23+00:00

In my gridview I put this code to get the click in my gridview

  • 0

In my gridview I put this code to get the click in my gridview row.

$('#grdImoveis tr').click(function () {
        openPopup('../Financeiro/DetalheImovelProposta.aspx', 'Detalhes', 'toolbar=yes,directories=no,status=yes,menubar=yes, scrollbars=yes,resizable=yes', '850', '600', 'true');
    });

In my gridview I have 5 columns. How can I get the value of the first column in the clicked row and pass via querystring ?

I think in some solution like this

$('#grdImoveis tr').click(function () {
        // Get the value of a specific column of my clicked row.
        //var imovel = $('# ???)
        openPopup('../Financeiro/DetalheImovelProposta.aspx?Imovel_id=' + imovel, 'Detalhes', 'toolbar=yes,directories=no,status=yes,menubar=yes, scrollbars=yes,resizable=yes', '850', '600', 'true');
    });

Markup:

<asp:GridView ID="grdImoveis" CssClass="StyleGrid" Width="100%" runat="server" AutoGenerateColumns="false" DataSourceID="dsGrid" BorderWidth="0" GridLines="None" OnRowDataBound="grdImoveis_DataBound">
        <AlternatingRowStyle BackColor="White" CssClass="EstiloDalinhaAlternativaGrid"  HorizontalAlign="Center"/>
        <RowStyle CssClass="EstiloDalinhaGrid" HorizontalAlign="Center" />
        <HeaderStyle BackColor="#e2dcd2" ForeColor="#000" CssClass="thGrid" Height="20" />
        <Columns>
            <asp:BoundField HeaderText="Código" DataField="Imovel_Id" />
            <asp:BoundField HeaderText="Tipo" DataField="TipoDsc1" />
            <asp:BoundField HeaderText="(L/V)" DataField="TransacaoSigla" />
            <asp:TemplateField HeaderText="Endereco">
                <ItemTemplate>
                    <%# Eval("Descricao") %> <%# Eval("Logradouro") %>, <%# Eval("Numero") %> - <%# Eval("Expr1") %> <%# Eval("Complemento") %>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField HeaderText="Propostas Ativas" DataField="NumeroProposta" />
        </Columns>
    </asp:GridView>
</div>
    <asp:SqlDataSource ID="dsGrid" runat="server" OnSelected="ds_Selected"></asp:SqlDataSource>

HTML Rendered:

<table class="StyleGrid" cellspacing="0" border="0" id="grdImoveis" style="border-width:0px;width:100%;border-collapse:collapse;">
            <tr class="thGrid" style="color:#000000;background-color:#E2DCD2;height:20px;">
                <th scope="col">C&#243;digo</th><th scope="col">Tipo</th><th scope="col">(L/V)</th><th scope="col">Endereco</th><th scope="col">Propostas Ativas</th>
            </tr><tr class="EstiloDalinhaGrid" align="center">
                <td>373034</td><td>Apartamento 3 quartos</td><td>V</td><td>
                    Rua COUROPITA, 998541 -  
                </td><td>1</td>
            </tr><tr class="EstiloDalinhaAlternativaGrid" align="center" style="background-color:White;">
                <td>372533</td><td>Apartamento 3 quartos</td><td>V</td><td>
                    Rua GIOVANI JOSÉ CHIODI, 362 - Apto 23
                </td><td>1</td>
            </tr><tr class="EstiloDalinhaGrid" align="center">
                <td>372387</td><td>Apartamento 6 quartos</td><td>V</td><td>
                    Rua GIOVANI JOSÉ CHIODI, 1625 - Fazenda 525
                </td><td>1</td>
            </tr><tr class="EstiloDalinhaAlternativaGrid" align="center" style="background-color:White;">
                <td>372383</td><td>Cobertura</td><td>V</td><td>
                    Avenida NOSSA SENHORA DO CARMO, 1623 - Loteamento 12
                </td><td>1</td>
            </tr><tr class="EstiloDalinhaGrid" align="center">
                <td>372310</td><td>Apartamento 4 quartos</td><td>V</td><td>
                    Rua MOARA, 362 - Sala 52
                </td><td>1</td>
            </tr><tr class="EstiloDalinhaAlternativaGrid" align="center" style="background-color:White;">
                <td>371853</td><td>Apartamento 3 quartos</td><td>V</td><td>
                    Rua GIOVANI JOSÉ CHIODI, 523 - Apto 362
                </td><td>1</td>
            </tr><tr class="EstiloDalinhaGrid" align="center">
                <td>370983</td><td>Apartamento 3 quartos</td><td>V</td><td>
                    Rua GIOVANI JOSÉ CHIODI, 163 - Condomínio 526
                </td><td>1</td>
            </tr><tr class="EstiloDalinhaAlternativaGrid" align="center" style="background-color:White;">
                <td>370400</td><td>Apartamento 3 quartos</td><td>V</td><td>
                    Rua teset, 35555 -  0
                </td><td>1</td>
            </tr><tr class="EstiloDalinhaGrid" align="center">
                <td>370181</td><td>Haras</td><td>V</td><td>
                    Rua A, 5266612 - Barracão 2
                </td><td>1</td>
            </tr><tr class="EstiloDalinhaAlternativaGrid" align="center" style="background-color:White;">
                <td>369833</td><td>Apartamento 4 quartos</td><td>V</td><td>
                    Rua teset, 2288 -  
                </td><td>4</td>
            </tr><tr class="EstiloDalinhaGrid" align="center">
                <td>369688</td><td>Apartamento 6 quartos</td><td>V</td><td>
                    Avenida NOSSA SENHORA DO CARMO, 1665 - Vaga 2
                </td><td>2</td>
            </tr><tr class="EstiloDalinhaAlternativaGrid" align="center" style="background-color:White;">
                <td>352992</td><td>Apartamento 3 quartos</td><td>L</td><td>
                    Travessa B-5, 787878 -  
                </td><td>1</td>
            </tr><tr class="EstiloDalinhaGrid" align="center">
                <td>343962</td><td>Andar/pilotis</td><td>V</td><td>
                    Avenida NOSSA SENHORA DO CARMO, 1650 -  testeeee2
                </td><td>1</td>
            </tr>
        </table>
  • 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-29T07:47:24+00:00Added an answer on May 29, 2026 at 7:47 am

    Skip the javascript stuff and do it server side instead. Add the following code in the RowDataBound event of the GridView

    protected void grdImovei_RowDataBound(Object sender, GridViewRowEventArgs e)
    {
        if(e.Row.RowType == DataControlRowType.DataRow)
        {
           var url = "../Financeiro/DetalheImovelProposta.aspx?Imovel_Id=" +
                     ((SomeType)r.Row.DataItem).Imovel_id.ToString();
    
           e.Row.Attributes.Add("onclick", "openPopup('" + url + "'," +
               @"'Detalhes', 
               'toolbar=yes,directories=no,status=yes,menubar=yes,
               scrollbars=yes,resizable=yes', '850', '600', 'true');");
        }
    }
    

    Where SomeType is the type of the items in your datasource.

    Edit
    For SqlDataSource try this:

    var url = "../Financeiro/DetalheImovelProposta.aspx?Imovel_Id=" +
                         ((DataRowView)r.Row.DataItem)["Imovel_id"].ToString();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How do I put a gridview row in edit mode programmatically?
I need to export a gridview to excel, I put the return html code
How do I put data into a gridview using programming code? I need an
I simply use commandName = Edit to put the gridview into edit mode. Then
When I put a HorizontalScrollView around a GridView, the GridView gets compressed into a
I am working on a co-workers website, and he mistakenly put up a gridview
i have a databound GridView in asp.net 2.0 with a row-selection link. When a
I have GridView which I can select a row. I then have a button
i have a gridview table like this... <div> <asp:GridView ID=GridView1 runat=server AllowSorting=true OnSorting=TaskGridView_Sorting >
Simply put, I have a series of videos with check boxes in a gridview.

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.