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.
Page load , filling controls with data, performance overhead?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Jay6 pointsPosted Jul 14, 2009, 9:51 PM EDT
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