Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Refreshing DataGrid in page_load

Reply
Thread Tools

Refreshing DataGrid in page_load

 
 
A.M
Guest
Posts: n/a
 
      10-30-2003
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(ConfigurationS ettings.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


 
Reply With Quote
 
 
 
 
Aaron @ PASC
Guest
Posts: n/a
 
      10-30-2003
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


"A.M" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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(ConfigurationS ettings.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
>
>



 
Reply With Quote
 
 
 
 
Jacob Yang [MSFT]
Guest
Posts: n/a
 
      10-31-2003
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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Self-refreshing and non-self-refreshing controls Harlan Messinger ASP .Net 1 08-04-2006 01:13 PM
Self-refreshing and non-self-refreshing controls Harlan Messinger ASP .Net Web Controls 0 08-03-2006 12:29 PM
in VB.NET Page_load of a base class called after the derived class Page_load ? z. f. ASP .Net 0 10-19-2004 12:01 PM
Why does page_load fire twice when inheriting from a common overridable Page_Load bminder ASP .Net 1 02-23-2004 08:54 PM
Refreshing DataGrid in page_load A.M ASP .Net 7 11-04-2003 02:27 PM



Advertisments