Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

95
Views
Valores de cuadro de texto rellenados automáticamente desde la base de datos

Tengo 4 cuadros de texto. Introduzco un valor en el primer cuadro de texto. Quiero que los siguientes 3 cuadros de texto se completen con valores automáticamente desde la base de datos según el valor ingresado en el primer cuadro de texto. ¿Se puede hacer esto en asp.net?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Bien, entonces tenemos un cuadro de texto para, por ejemplo, una "identificación" de algún tipo, como esta:

 <div style="text-align:right;width:300px"> Enter Hotel ID :<asp:TextBox ID="askHotel" runat="server" AutoPostBack="true"></asp:TextBox> <br /> <br /> Hotel Name :<asp:TextBox ID="txtHotel" runat="server" Width="180px"></asp:TextBox> <br /> City :<asp:TextBox ID="txtCity" runat="server" Width="180px"></asp:TextBox> <br /> Active :<asp:CheckBox ID="Active" runat="server" ></asp:CheckBox> </div>

Y nuestro código es:

 Protected Sub askHotel_TextChanged(sender As Object, e As EventArgs) Handles askHotel.TextChanged Using cmdSQL As New SqlCommand("SELECT * FROM tblHotels WHERE ID = @ID", New SqlConnection(My.Settings.TEST4)) cmdSQL.Parameters.Add("@ID", SqlDbType.Int).Value = askHotel.Text cmdSQL.Connection.Open() Dim rst As New DataTable rst.Load(cmdSQL.ExecuteReader) If rst.Rows.Count > 0 Then With rst.Rows(0) txtHotel.Text = .Item("HotelName") txtCity.Text = .Item("City") Active.Checked = .Item("Active") End With End If End Using End Sub

Producción:

ingrese la descripción de la imagen aquí

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!