All,
I'm using Visual Studio 2008/C# and Sql Server 2005 express. I have a dropdownlist which is connected to a SqlDataSource that queries a Names table to display a name. Also, there's a text box and a GridView. The idea is the user selects his name from the dropdownlist, enters some text in the texbox and clicks on a button called 'Check In'. This button sends an 'Insert' statement to SS2005 and logs it the a table called Events. The GridView is connected to the Events table via a SqlDataSource Connection. Everything works but is there a way to have the GridView automatically refresh (postback?) itself after the user clicks on the Check In button?
cheers!
AJPosted Jun 10, 2008, 6:06 PM
Here's what worked. I added the GridView.DataBind() method to the bottom of the code for the command button. That seemed to work since it re-binds the data and queries the table again.
Thanks!
Scott LyslePosted Jun 8, 2008, 9:23 PM
You can implement the OnInserted call; though it you can call a code block each time an insert is performed, within the code block you can bind the datagrid. Check OnInserted Method in your visual studio help files.