Search code examples
gridviewpaginationcustompaging

Button Click event getting fired after rowdatabound for grid view


When I click on a button which is outside of the GridView in my asp.net page, the GridView rowdatabound event is getting fired before OnClick event for the button. I am using the button for custom paging so I need to reverse the order of these events. Any thoughts ??

Thanks in Advance, - Amit


Solution

  • Possibly because you are calling DataBind() on the GridView in the Page_Load event. You should note that Page_Load will always be called before the event that raised the postback... the Button_Click in your case.

    I suggest reading up on the ASP.NET Page Life cycle to learn more.