Skip to content

Page load , filling controls with data, performance overhead?

Haseeb Saeed

Asked Jun 22, 2009, 8:21 PM EDT1 answer
Share
LinkedInX
Hi,
I want to fill a dropdownlist and datagrid from a sql datatable in asp.net page. In past i have been doing this in page load method. I just want to know which method is good for retrieving data from sql and assigning to controls. I was revising the page cycle concepts and it seemed that page.load method is called recursively for each control. if that is the case then i think, i am incorrect when i use page load method. Please correct me. Thanx.

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Hi,

    You can write your code inside "If Not IsPostBack Then ------End If" In pageload event . coz this will execute the code only when the page is loading first time

    Eg:
    ---
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

      If Not IsPostBack Then
      ' write a code for filling process
      End If
    End Sub
    0