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

J

jonny

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

On click of button run query to fill gridView.
 
B

Brandon Gano

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
 
M

Masudur

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,439
Members
44,829
Latest member
PIXThurman

Latest Threads

Top