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

  • Home
  • SEARCH
  • 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 8830047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:58:39+00:00 2026-06-14T07:58:39+00:00

This is my first time with ASP and I’m a little messed with it.

  • 0

This is my first time with ASP and I’m a little messed with it. I’m coding an interface that grabs information from a database and displays it in a table. For that I’m using an asp button that takes the text from an asp textbox once I click the button in the onClick event I do the connection to the database, execute the query and print the html to the main page.

The problem is that once I click the button the resultant html is rendered at the top of the page and the textbox and the button remains below, forcing me to scroll down to make another search.

This is my onClick code if it helps:

If Not SearchBox.Text Is Nothing Then

        Dim conn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" &
                                      "Data Source= C:\Users\user\Documents\Visual Studio 2012\Projects\Aplicación UNED\Aplicación UNED\App_Data\Libros.mdb")

        Dim query = New OleDbCommand("SELECT * FROM Libros WHERE Titulo LIKE '%" & SearchBox.Text & "%'", conn)

        Dim adapter = New OleDbDataAdapter(query)

        Dim res = New DataSet()
        adapter.Fill(res, "Libros")
        Response.Write("<table class='data_table'>")
        Response.Write("<thead><tr class='data_table_info'><th scope='col'>Titulo</th><th scope='col'>Resumen</th><th scope='col'>Categoria</th><th scope='col'>ISBN</th><th scope='col'>PrecioConIVA</th><th scope='col'>EnlaceCompra</th></tr></thead>")
        For Each Fila In res.Tables("Libros").Rows
            Response.Write("<tr><td>" & Fila("Titulo") & "</td><td>" & Fila("Resumen") & "</td><td>" & Fila("Categoria") & "</td><td>" & Fila("ISBN") & "</td><td>" & Fila("PrecioConIVA") & "</td><td>" & Fila("EnlaceCompra") + "</td></tr>")
        Next
        Response.Write("</table>")
        conn.Close()
    End If
End Sub

Regards.

  • 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-14T07:58:40+00:00Added an answer on June 14, 2026 at 7:58 am

    Instead of using Response.Write, introduce a Literal control below your button and assign the generated text to the Text property of your Literal. This will ensure that your content displays below your button.

    Assuming you have an ASP.NET Textbox by the name SearchBox <asp:Textbox id="SearchBox" runat="server" /> place the literal below it

    <asp:Textbox id="SearchBox" runat="server" />
    <br />
    <asp:Literal id="ResultHtml" runat="server" />
    

    and in your code behind, replace the Response.Write calls with

    Dim sb = new StringBuilder("<table class='data_table'>")
    sb.Append("<thead><tr class='data_table_info'><th scope='col'>Titulo</th><th scope='col'>Resumen</th><th scope='col'>Categoria</th><th scope='col'>ISBN</th><th scope='col'>PrecioConIVA</th><th scope='col'>EnlaceCompra</th></tr></thead>")
    
          For Each Fila In res.Tables("Libros").Rows
              sb.Append("<tr><td>" & Fila("Titulo") & "</td><td>" & Fila("Resumen") & "</td><td>" & Fila("Categoria") & "</td><td>" & Fila("ISBN") & "</td><td>" & Fila("PrecioConIVA") & "</td><td>" & Fila("EnlaceCompra") + "</td></tr>")
          Next
    
    sb.Append("</table>")    
    ResultHtml.Text = sb.ToString()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is the first time that I'm doing this, so I need a little
This is my first time attempting to call an ASP.NET page method from jQuery.
This is my first time trying to use a database in ASP.Net, and I
I'm creating an asp.net MVC app, first time I've done this. I have a
This is my first time working with a WPF datagrid. From what I understand
This is my first time that I use WCF and Android. So, sorry for
when I access any page of my ASP.NET MVC website first time, then this
I am currently working on an ASP.NET MVC2 project. This is the first time
Its my first time with asp.net MVC 2. Im came from asp.net webforms. I
This is my first time to deploy an asp.net web site. Everything is working

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.