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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:18:28+00:00 2026-05-30T05:18:28+00:00

I have a GridView with some columns. If exist a value in my database,

  • 0

I have a GridView with some columns. If exist a value in my database, a cell in my gridview has to updated his own value.

For example:

      1     2    
1 - Lucas   Delete 
2 - Drake   Delete
3 - Jimmy   Update/Delete

If Jimmy exists in my DataBase, then I have to put the “Update/Delete” in my second column, but if this “Update” label is clicked, I call a javascript. How can I do that ? It can be done via Sql ?

My code-behind:

protected void carregaGrid()
        {
            Utilidade.QuebraToken tk = new Utilidade.QuebraToken();
            string Credenciada = tk.CarregaToken(1, Request.Cookies["token"].Value);
            string Proposta = string.Empty;
            string select = string.Empty;         

                select = "SELECT San_Proposta.Proposta_Id, San_Proposta.DataHora, San_Proposta.ValorProposta, San_Proposta.Comentario, "
                    + "San_Usuario.NomeCompleto, San_Credenciada.Apelido, San_StatusProposta.Descricao, "
                    + "(SELECT COUNT(*) "
                    + "FROM San_PropostaConversa "
                    + "WHERE San_PropostaConversa.Proposta_Id = San_Proposta.Proposta_Id "
                    + "AND San_PropostaConversa.Credenciada_Id = San_Proposta.Credenciada_Id) as Numero "
                    + "FROM San_Proposta "
                    + "JOIN San_Credenciada "
                    + "ON San_Proposta.Credenciada_Id = San_Credenciada.Credenciada_Id "
                    + "JOIN San_StatusProposta "
                    + "ON San_Proposta.StatusProposta_Id = San_StatusProposta.StatusProposta_Id "
                    + "JOIN San_Usuario "
                    + "ON San_Proposta.Usuario_Id = San_Usuario.Usuario_Id ";

                if (Request.QueryString["Imovel_Id"].ToString() != string.Empty)
                {
                    string imovel = Request.QueryString["Imovel_Id"].ToString();
                    select += "WHERE San_Proposta.Imovel_Id = " + imovel + " "
                         + "AND San_Proposta.Credenciada_Id = " + Credenciada + " "
                         + "AND San_Proposta.StatusProposta_Id IN (1,2) ";
                }                
            }

            select += "ORDER BY San_Proposta.DataHora DESC, Apelido ";

            neticonn.Conexao c = new neticonn.Conexao();
            dsGrid.ConnectionString = c.Con;
            dsGrid.SelectCommand = select;            
        }
  • 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-30T05:18:29+00:00Added an answer on May 30, 2026 at 5:18 am

    You have to use an ajax request to check if your item exists in your database. Your script will return you a json with true if your request finds it, false otherwise.

    The other way is to build a javascript array on your page loading and check on it if your value is present.

    I don’t know c#, but in php it will do something like :

    <script>
    var values = [
    <?php 
    foreach ($valueFromDatabase as $key => $value) {
         echo '"'.$value.'"';
         //Hack to remove the last comma
         if ($value == $valueFromDatabase[$valueFromDatabase.length - 1]) {
            echo ",";
         }
    }
    ?>
    ];
    </script>
    

    It will make you a javascript array looking like :

    var values = ["Lucas","Drake","Jimmy"];
    

    You just have to loop on this array to check if an element exists or use a javascript function to do that.

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

Sidebar

Related Questions

I have a gridview that has some 20 columns and 1000 rows. The grid
Background: I have a ListView / GridView with several columns. In some situations, only
I have a gridview were I define some columns, like this... <GridViewColumn.CellTemplate> <DataTemplate> <TextBlock
i have a GridView bound to a DataView. Some columns in the DataView's table
I have a GridView which retrieves data from a database. Users have roles, some
I have some columns being added to a GridView in codebehind. In the actual
I have a GridView and when some data has been inserted I have called
I currently have a gridview that has an asp:ButtonField as one of the columns.
I have a gridview with some columns and I need to sort the gridview
I have a gridview, with some columns. I want to hide one column, but

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.