Start New Discussion within our Software Development Community

Hello,

I am new in VB and I have a problem. I'm trying to make a page where you enter some data in the textbox and on button click you search a database and you have a results in grid. But on button click nothing happens. Here is my code. Thank you in advanced

<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
      ConnectionString="<%$ ConnectionStrings:RIL_FilijalaConnectionString %>" 
      
      SelectCommand="SELECT * from ol
AND (OL.JMBG = @TextBox1) ">
      <SelectParameters>
        <asp:ControlParameter ControlID="TextBox1" Name="TextBox1" 
          PropertyName="Text" />
      </SelectParameters>
    </asp:SqlDataSource>


<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

<asp:Button ID="Button1" runat="server" Text="PoĊĦalji" />

<asp:GridView ID="GridView1" runat="server" EmptyDataText="Nothing"> </asp:GridView>

And here is the code behind

Public Class About
  Inherits System.Web.UI.Page

  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

  End Sub

  Protected Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As EventArgs) Handles TextBox1.TextChanged

  End Sub

  Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
    GridView1.DataSource = SqlDataSource1
    GridView1.DataBind()
  End Sub

  Protected Sub SqlDataSource1_Selecting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs) Handles SqlDataSource1.Selecting

  End Sub

  Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles GridView1.SelectedIndexChanged

  End Sub
End Class
This article has been dead for over six months. Start a new discussion instead.