I would like to add a button that the user can click to execute query - fills gridView control

  • Thread starter Thread starter jonny
  • Start date Start date
J

jonny

How can I do this with ASP controls & VB.NET

On click of button run query to fill gridView.
 
I think you want something like this (forgive the sloppy VB; I'm a C# guy):

--aspx--
<asp:Button ID="MyButton" runat="server" Text="Fill"
OnClick="MyButton_Click" />
<asp:GridView ID="MyGrid" runat="server" ...>
...
</asp:GridView>

--aspx.vb--
Protected Sub MyButton_Click(ByVal sender As Object, ByVal e As EventArgs)

'TODO: Create data source (MyDataSource)

MyGrid.DataSource = MyDataSource
MyGrid.DataBind()

End Sub
 
I think you want something like this (forgive the sloppy VB; I'm a C# guy):

--aspx--
<asp:Button ID="MyButton" runat="server" Text="Fill"
OnClick="MyButton_Click" />
<asp:GridView ID="MyGrid" runat="server" ...>
...
</asp:GridView>

--aspx.vb--
Protected Sub MyButton_Click(ByVal sender As Object, ByVal e As EventArgs)

'TODO: Create data source (MyDataSource)

MyGrid.DataSource = MyDataSource
MyGrid.DataBind()

End Sub

Hi...

don't forget to visit the asp.net data tutorials...
every thing you need to work with data is there...
http://www.asp.net/learn/data-access/

Masudur
 
Back
Top