Search code examples
asp.netuser-controlsascxpageload

Page_load filling data after loading UserControl ASP.net


I have an aspx Page that contain a userControl that contains textboxes.

in the page_load method, it reads from the database, and i want to fill the textboxes of the usercontrol with the data been read.

the problem i am facing, that the flow of page loading is

Page_Load of the page, where i am assigning the text field, then it page_load of the userControl, so here all the data will be erased, then it will show the page.

how i can fix this.


Solution

  • in this case, you have to fill the data of UserControl in Page_Init not Page_Load, the problem here will be solved :)