all groups > asp.net datagrid control > october 2003 >
You're in the

asp.net datagrid control

group:

Refreshing DataGrid in page_load


Re: Refreshing DataGrid in page_load Aaron NO[at]SPAM PASC
10/30/2003 12:39:28 PM
asp.net datagrid control:
Do you have the code incapsulated in a:

If Not IsPostBack Then conditional? If so you would need to take the Fill
and DataBind code outside of the conditional as well.

Just a thought,
Aaron


[quoted text, click to view]

Refreshing DataGrid in page_load A.M
10/30/2003 3:36:57 PM
Hi,

I want to refresh my DataGrid data on every postback.
I have following code in Page_Load event, but after first page load, the
DataGrid never gets refresh.

Here is the code i have in Page_load (it works at first page_load):

Dim DS As DataSet
Dim MyConnection As System.Data.SqlClient.SqlConnection
Dim MyCommand As System.Data.SqlClient.SqlDataAdapter

MyConnection = New
System.Data.SqlClient.SqlConnection(ConfigurationSettings.AppSettings("ConnS
tr"))
MyCommand = New System.Data.SqlClient.SqlDataAdapter("SELECT * FROM tblLog",
MyConnection)

DS = New DataSet
MyCommand.Fill(DS, "Log")

MyDataGrid.DataSource = DS.Tables("Log").DefaultView
MyDataGrid.DataBind()



Thanks,
Ali

RE: Refreshing DataGrid in page_load jiany NO[at]SPAM online.microsoft.com
10/31/2003 11:50:54 AM
Hi Ali,

I noticed that you posted the same question in the
microsoft.public.dotnet.framework.aspnet group. I have replied you on that
thread. Please check it when you have time.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
AddThis Social Bookmark Button