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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:33:57+00:00 2026-05-26T06:33:57+00:00

How can I, on the OnChange event, update data in my database ? I

  • 0

How can I, on the OnChange event, update data in my database ?
I have a WebMethod, that returns a HTML, so I can’t see those elements, so I think he solution will be a javascript function.

A textarea catch the text from the database, if the user alter this, the database field has to be updated.

    [WebMethod]
    public static object ListAdvertise(string transaction)
    {
        StringBuilder retorno = new StringBuilder(160000);

        Utilidade.QuebraToken tk2 = new Utilidade.QuebraToken();
        string Credenciada = tk2.CarregaToken(1, HttpContext.Current.Request.Cookies["token"].Value);


        string select3 = "SELECT * FROM San_Imovel WHERE Status_Id = 1 AND Credenciada_Id = " + Credenciada + " AND Transacao_Id IN (" + transacao + ") ORDER BY NomeCidade, NomeBairro, Imovel_Id ASC";


        Utilidade.Conexao c3 = new Utilidade.Conexao();
        SqlConnection con3 = new SqlConnection(c3.Con);
        SqlCommand cmd3 = new SqlCommand(select3, con3);
        con3.Open();
        SqlDataReader r3 = cmd3.ExecuteReader();
        while (r3.Read())
        {
            Imovel_Id = r3["Imovel_Id"].ToString();
            Endereco = r3["Descricao"].ToString() + " " + r3["Logradouro"].ToString() + " " + r3["Numero"].ToString() + "/" + r3["DscComplemento"].ToString() + " " + r3["Complemento"].ToString() + " - " + r3["NomeBairro"].ToString();
            TextoAnuncio = r3["TextoAnuncio"].ToString();

            if (count % 2 == 0)
            {
                classe = "EstiloDalinhaGrid";
            }
            else
            {
                classe = "EstiloDalinhaAlternativaGrid";
            }


            retorno.Append("<tr class='" + classe + "'>");
            retorno.Append("<td>");
            retorno.Append(Imovel_Id);
            retorno.Append("</td>");

            retorno.Append("<td>");
            retorno.Append(Endereco);
            retorno.Append("</td>");

            retorno.Append("<td>");
        retorno.Append("<textarea id='txtArea'>");
            retorno.Append(TextoAnuncio);
        retorno.Append("</textarea>");
            retorno.Append("</td>");

            retorno.Append("<td>");
            retorno.Append("<input type='checkbox' class='imoveisMarcados' id='" + Imovel_Id + "' />");
            retorno.Append("</td>");
            retorno.Append("</tr>");

            count++;
        }

        retorno.Append("</table>");
        con3.Close();

        return new
        {
            retorno = string.Format(retorno.ToString())
        };
  • 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-26T06:33:57+00:00Added an answer on May 26, 2026 at 6:33 am

    i think you have to use Ajax for you to be able to update your data base .

    check this link to learn more about ajax with Php (you chose whatever server side langage you’d like)

    Ajax with PHP

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

Sidebar

Related Questions

Is there a client event that I can use for when a DropDownList's data
I have a select dropdown in a html file that i can't really touch
I have an address block on a view which can swap some data if
I have a page that displays a list of records. The user can select
The database that I am working on (in MS-Access XP) seems to have become
It might be a beginner question but I can't understand why the onchange event
I have this code which is looking for an onchange event: //Create destination switch
I have the following code which is designed to create an onchange event handler
I have a page with a dropdown. The onchange event calls a Javascript function
How can I force the input's onchange script to run before the RangeValidator's script?

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.